The -d switch is used to detect intersecting facets in your input.
The inputs of TetGen are called piecewise linear complexes (PLCs). The definition of PLCs requires that they must be closed under taking intersections, that is two segments only can intersect at a shared point, two facets are either completely disjointed or intersecting only at shared segments or vertices, etc.
However, models created by most of the CAD tools usually do not satisfy this condition. TetGen can check and find out all the intersecting facets of the input PLCs and report in triangle pairs. This is done by using the switch '-d'.
Example of Using the '-d' Switch
Below is an example shows how it works. The input is a surface mesh
of a cow (cow.smesh) which has 2903
nodes and 5804 triangles. Using the command line:
tetgen -d cow.smeshThe detected intersecting facets are printed on the screen like followling:
Detecting intersecting facets. Facet #5672 intersects facet #5730 at triangles: (2872, 2874, 2873) and (2834, 2873, 2833) Facet #5726 intersects facet #5750 at triangles: (2872, 2873, 2834) and (2868, 2874, 2872) Facet #5730 intersects facet #5750 at triangles: (2834, 2873, 2833) and (2868, 2874, 2872) ... !! Found 211 pairs of faces are intersecting. Intersection seconds: 3.33 Writing cow.1.node. Writing cow.1.face.On completion, a list of intersecting triangles are saved in a .face file (i.e., cow.1.face) which can be visualized by TetView as shown in the following pictures. This helps to fix the problem.
The surface mesh of a cow.
The intersecting triangles.
A closed view of some intersecting triangles.
This feature has another application: detecting two or more polyhedra are intersecting or not. You can describe these polyhedra in one of the file formats (.poly, .smesh, .off, .ply, .stl), then call TetGen with the -d switch only.