DATAKIT SDK  V2026.1
Tesselation main functions

All the basics functions you need to tesselate any Dtk brep data structures. To better control the tesselation process, see section Tesselation options. More...

Functions

Dtk_ErrorStatus tess_BodyToMeshes (const Dtk_BodyPtr &inBodyToWrite, Dtk_tab< Dtk_MeshPtr > &outMeshes, Dtk_tab< Dtk_Int32 > &outIsSolid, Dtk_bool inTessWireframe=DTK_FALSE, Dtk_bool inApplyRenderInfos=DTK_FALSE)
 Tesselate a body. Generates one mesh per shell in the body. More...
 
void tess_EndTesselation ()
 Free the data used by tesselation library. More...
 
Dtk_ErrorStatus tess_FacesArrayToMesh (Dtk_tab< Dtk_FacePtr > &inTabFace, Dtk_MeshPtr &outMesh, Dtk_Int32 *outIsSolid)
 Tesselate an array of Faces. More...
 
Dtk_ErrorStatus tess_FaceToMesh (Dtk_FacePtr &inFace, Dtk_MeshPtr &outMesh)
 Tesselate a single face. More...
 
void tess_getBoundariesFromMeshFace (const Dtk_MeshPtr &mesh, const Dtk_mesh_face *inFace, Dtk_tab< Dtk_tab< Dtk_PolylinePtr >> &outBoundaries)
 Get the boundaries (outer and inner) of a mesh face as polylines. Each shell yields a Dtk_mesh, each face of the shell yields a Dtk_mesh_face in the Dtk_mesh, and each edge of the face yields a Dtk_Polyline that you can get with this function. To get the body indice of the corresponding edge, use polyline->get_info()->FindAttribute("TOPO_ID_EDGE",dtk_val) where dtk_val is an integer value containing the TopoId of the edge. The first polyline is the outer boundary, the others are inner boundaries (holes). More...
 
int tess_InitTesselation ()
 Init the tesselation library with parameters suited for most visualisation purposes Linear tolerance is deactivated, and angular tolerance set to 10 degrees. More...
 
int tess_InitTesselation (Dtk_string inWorkingDirectory, double inTolerance)
 Init the tesselation library. More...
 
Dtk_ErrorStatus tess_ShellToMesh (const Dtk_ShellPtr &inShell, Dtk_MeshPtr &outMesh, Dtk_Int32 *outIsSolid)
 Tesselate a shell. More...
 
Dtk_ErrorStatus TesselationIsStarted ()
 Return current status of tesselation started. More...
 

Detailed Description

All the basics functions you need to tesselate any Dtk brep data structures. To better control the tesselation process, see section Tesselation options.

Function Documentation

◆ tess_BodyToMeshes()

Dtk_ErrorStatus tess_BodyToMeshes ( const Dtk_BodyPtr inBodyToWrite,
Dtk_tab< Dtk_MeshPtr > &  outMeshes,
Dtk_tab< Dtk_Int32 > &  outIsSolid,
Dtk_bool  inTessWireframe = DTK_FALSE,
Dtk_bool  inApplyRenderInfos = DTK_FALSE 
)

Tesselate a body. Generates one mesh per shell in the body.

Parameters
[in]inBodyToWrite: Body to be tessellate
[out]outMeshes: Result meshes, one Dtk_MeshPtr per shell
[out]outIsSolid: Info on each mesh topology. 0 if open, 1 if closed
[in]inTessWireframe: Enable the tesselation of wireframes contained in the body's shell. See Dtk_Shell::GetNumWireSet()
[in]inApplyRenderInfos: Enable the application of render infos from body to mesh

◆ tess_EndTesselation()

void tess_EndTesselation ( )

Free the data used by tesselation library.

◆ tess_FacesArrayToMesh()

Dtk_ErrorStatus tess_FacesArrayToMesh ( Dtk_tab< Dtk_FacePtr > &  inTabFace,
Dtk_MeshPtr outMesh,
Dtk_Int32 outIsSolid 
)

Tesselate an array of Faces.

Parameters
[in]inTabFace: Faces to be tesselate
[out]outMesh: Result mesh
[out]outIsSolid: Info on mesh topology. 0 if open, 1 if closed

◆ tess_FaceToMesh()

Dtk_ErrorStatus tess_FaceToMesh ( Dtk_FacePtr inFace,
Dtk_MeshPtr outMesh 
)

Tesselate a single face.

Parameters
[in]inFace: Face to be tesselate
[out]outMesh: Result mesh

◆ tess_getBoundariesFromMeshFace()

void tess_getBoundariesFromMeshFace ( const Dtk_MeshPtr mesh,
const Dtk_mesh_face inFace,
Dtk_tab< Dtk_tab< Dtk_PolylinePtr >> &  outBoundaries 
)

Get the boundaries (outer and inner) of a mesh face as polylines. Each shell yields a Dtk_mesh, each face of the shell yields a Dtk_mesh_face in the Dtk_mesh, and each edge of the face yields a Dtk_Polyline that you can get with this function. To get the body indice of the corresponding edge, use polyline->get_info()->FindAttribute("TOPO_ID_EDGE",dtk_val) where dtk_val is an integer value containing the TopoId of the edge. The first polyline is the outer boundary, the others are inner boundaries (holes).

Note
This function requires that the option tess_ComputeBoundariesFromMesh() is enabled (default behaviour).
Function Dtk_mesh_face::get_polyline_indices() provide point indices of the mesh face boundaries, but there are not ordered as continuous polylines. tess_getBoundariesFromMeshFace extracts the boundaries as ordered polylines.
Parameters
[in]mesh
[in]inFace = face to be processed
[out]outBoundaries = result function Sample:
Dtk_Size_t nbFace =mesh->get_nb_mesh_face();
for ( int iFace = 0; iFace < nbFace; iFace++ )
{
Dtk_mesh_face * meshFace = mesh->get_mesh_face(iFace);
tess_getBoundariesFromMeshFace(mesh, meshFace, boundaries);
const Dtk_Size_t nbloop = boundaries.size();
for ( Dtk_Size_t iLoop = 0; iLoop < nbloop; iLoop++)
{
Dtk_tab<Dtk_PolylinePtr> loop = boundaries[iLoop];
for ( Dtk_Size_t iEdge = 0; iEdge < loop.size(); iEdge++ )
{
Dtk_PolylinePtr polyline = loop[iEdge];
Dtk_Val edgeIdInOriginalBody;
polyline->get_info()->FindAttribute("TOPO_ID_EDGE",edgeIdInOriginalBody);
}
}
}

◆ tess_InitTesselation() [1/2]

int tess_InitTesselation ( )

Init the tesselation library with parameters suited for most visualisation purposes Linear tolerance is deactivated, and angular tolerance set to 10 degrees.

Warning
This function disable the linear tolerance, see tess_set_linearTolerance(). It is suited for visualisation purpose only. If you need a more precise tesselation control using linear tolerance, call tess_disableTolLinear(DTK_FALSE) to re-enable it.
Returns
0 if OK
-4 if no licence found

◆ tess_InitTesselation() [2/2]

int tess_InitTesselation ( Dtk_string  inWorkingDirectory,
double  inTolerance 
)

Init the tesselation library.

Parameters
[in]inWorkingDirectory: Directory for temporary file used for tesselation
[in]inTolerance(mm): Maximum accepted chordal error between the CAD surface and the tesselated mesh
Returns
0 if OK
-4 if no licence found

◆ tess_ShellToMesh()

Dtk_ErrorStatus tess_ShellToMesh ( const Dtk_ShellPtr inShell,
Dtk_MeshPtr outMesh,
Dtk_Int32 outIsSolid 
)

Tesselate a shell.

Parameters
[in]inShell: Shell to be tesselate
[out]outMesh: Result mesh
[out]outIsSolid: Info on mesh topology. 0 if open, 1 if closed

◆ TesselationIsStarted()

Dtk_ErrorStatus TesselationIsStarted ( )

Return current status of tesselation started.

Dtk_mesh_face
This is a high level face class.
Definition: util_mesh_dtk.hpp:865
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:715
Dtk_Val
Definition: dtk_val.hpp:67
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
tess_getBoundariesFromMeshFace
void tess_getBoundariesFromMeshFace(const Dtk_MeshPtr &mesh, const Dtk_mesh_face *inFace, Dtk_tab< Dtk_tab< Dtk_PolylinePtr >> &outBoundaries)
Get the boundaries (outer and inner) of a mesh face as polylines. Each shell yields a Dtk_mesh,...
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503