Skip to content

Commit

Permalink
add slice
Browse files Browse the repository at this point in the history
  • Loading branch information
filiatra committed Jul 25, 2024
1 parent 23ea1f8 commit d6f6907
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
18 changes: 18 additions & 0 deletions examples/geometry_cexample.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ int main(int argc, char* argv[])
if (irow==2) { printf("\n"); }
}


gsCMatrix * tMat = gsMatrix_create();
gsCVector * tVec = gsVector_create();
gsCGeometryTransform * tr = gsGeometryTransform_create(G, tMat, tVec);
destroy(tr);
destroy(tMat);
destroy(tVec);

gsCGeometry * isoparam = gsTensorBSpline2_slice(G, 0, 0.5);
print(isoparam);
destroy(isoparam);


// tb.slice(dir, param, result);
//equidistant sampling. arc length curve (+surface..)
//


destroy(uvm);
destroy(out_d);
destroy(G);
Expand Down
14 changes: 12 additions & 2 deletions src/gsCGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GISMO_EXPORT gsCGeometry* gsTensorBSpline2_create(gsCBasis* b, gsCMatrix * coefs
auto * m = RICAST_M(coefs);
return RICAST_CG(new gismo::gsTensorBSpline<2,double>(*basis_ptr,*m));
}

GISMO_EXPORT gsCGeometry* gsTensorBSpline3_create(gsCBasis* b, gsCMatrix * coefs)
{
gismo::gsTensorBSplineBasis<3,double>* basis_ptr = reinterpret_cast< gismo::gsTensorBSplineBasis<3,double>* >(b);
Expand Down Expand Up @@ -96,6 +96,16 @@ GISMO_EXPORT gsCGeometry* gsHBSpline4_create(gsCBasis* b, gsCMatrix * coefs)
return RICAST_CG(new gismo::gsHBSpline<4,double>(*basis_ptr,*m));
}

GISMO_EXPORT gsCGeometry* gsTensorBSpline2_slice(gsCGeometry * g, int direction, double parameter)
{
auto * g_ptr = reinterpret_cast< gismo::gsTensorBSpline<2,double>* >(g);
typedef typename gsTensorBSpline<2,double>::BoundaryGeometryType GeometryBdr;
GeometryBdr * bdr = new GeometryBdr();
g_ptr->slice(direction, parameter, *bdr);
return RICAST_CG(bdr);
}


GISMO_EXPORT gsCBasis* gsGeometry_basis(gsCGeometry * g)
{ return RICAST_CB(&RICAST_G(g)->basis()); }

Expand Down Expand Up @@ -163,4 +173,4 @@ GISMO_EXPORT double gsGeometry_closestPointTo(gsCGeometry * fs,

#ifdef __cplusplus
}
#endif
#endif
2 changes: 2 additions & 0 deletions src/gsCGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extern "C"
GISMO_EXPORT gsCGeometry* gsHBSpline3_create(gsCBasis* b, gsCMatrix * coef);
GISMO_EXPORT gsCGeometry* gsHBSpline4_create(gsCBasis* b, gsCMatrix * coef);

GISMO_EXPORT gsCGeometry* gsTensorBSpline2_slice(gsCGeometry * g, int direction, double parameter);

GISMO_EXPORT gsCBasis* gsGeometry_basis(gsCGeometry * g);

GISMO_EXPORT void gsGeometry_coefs_into(gsCGeometry * g, gsCMatrix * coef);
Expand Down

0 comments on commit d6f6907

Please sign in to comment.