DATAKIT API  V2025.1
Sample to tessellate a Dtk_Body
/*If you want to use tessellation library start Tesselation Kernel*/
int status = tess_InitTesselation("tess_tmp",0.05);
// optional parameter
// the following parameter can be call with different value between two
tess_set_angular(0.1745329); // for 10°
tess_set_Ratio(2.0); // see documentation of this function
if ( NoBoundarieCOmpute == TRUE )
if ( NoNormalesComputed == TRUE )
else
const Dtk_BodyPtr TmpBody = inNode->GetDtk_BodyPtr();
if (TmpBody)
{
//we scan all Shell and tesselate one mesh per shell
Dtk_Size_t i,nb,j,nb2,k,nb3,l,nb4;
nb = TmpBody->GetNumLumps();
for ( i=0;i<nb;i++)
{
TmpBody->GetLump(i,lump);
nb3=lump->GetNumVolumes();
for (k=0;k<nb3;k++)
{
lump->GetVolume(k,vol);
nb4=vol->GetNumShells();
for (l=0;l<nb4;l++)
{
Dtk_Int32 isclosed;
vol->GetShell(l,sh);
int err_tess = tess_ShellToMesh(sh,mh,&isclosed);
if(err_tess == 0)
{
/*Your function writing a mesh */
user_WriteDtk_Mesh(mh);
}
else
{
sprintf(ss,"Tesselation error %d\n",err_tess);
}
} // end of shell
} // end of volum
} // end of lump
nb2 = TmpBody->GetNumOpenShells();
for ( j=0;j<nb2;j++)
{
Dtk_Int32 isclosed;
TmpBody->GetOpenShell(j,sh);
int err_tess = tess_ShellToMesh(sh,mh,&isclosed);
if(err_tess == 0)
{
/*Your function writing a mesh */
user_WriteDtk_Mesh(mh);
}
else
{
sprintf(ss,"Tesselation error %d\n",err_tess);
}
}
}
/*Close Tesselation kernel*/

Sample to write a Dtk_mesh

tess_set_optimize_mesh
void tess_set_optimize_mesh(int ival)
: Activate or not the optimization of the vertex map
tess_set_Ratio
void tess_set_Ratio(double tol)
: define a ratio
tess_ShellToMesh
Dtk_ErrorStatus tess_ShellToMesh(const Dtk_ShellPtr &inShell, Dtk_MeshPtr &outMesh, Dtk_Int32 *outIsSolid)
: Make Tesselation from a Dtk_shell and create a Dtk_MeshPtr if available
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
tess_InitTesselation
int tess_InitTesselation(Dtk_string inWorkingDirectory, double inTolerance)
Init the tesselation library.
tess_ComputeNormalesFromSurface
int tess_ComputeNormalesFromSurface()
: Check value of option compute normales of vertex from real surface
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:687
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
tess_ComputeBoundariesFromMesh
int tess_ComputeBoundariesFromMesh()
: Check value of option memorize noundaries of mesh
tess_set_angular
void tess_set_angular(double angle)
: Set angle for cord heigh ratio method
tess_EndTesselation
void tess_EndTesselation()
Free the data used by tesselation library.
Dtk_Node::GetDtk_BodyPtr
Dtk_BodyPtr GetDtk_BodyPtr()
Retrieves the Dtk_Node as a Dtk_BodyPtr - if exists -.
tess_set_linear
void tess_set_linear(double tol)
: Set tolerance for linear tolerance method