Computes surface intersections.
More...
#include <geogram/mesh/mesh_surface_intersection.h>
|
class | MeshInTriangle |
|
class | CoplanarFacets |
|
Computes surface intersections.
New vertices are stored with exact coordinates
Definition at line 68 of file mesh_surface_intersection.h.
◆ build_Weiler_model()
void GEO::MeshSurfaceIntersection::build_Weiler_model |
( |
| ) |
|
|
protected |
Builds the Weiler model.
The Weiler model is a volumetric representation, where each facet is on the boundary of a closed region. Facets are duplicated, so that when two regions touch each other, each region has its own facet on the boundary. Two facets that touch in this way are connected by alpha3 links. Facets on the boundary of the same region are connected by alpha2 links.
◆ classify()
void GEO::MeshSurfaceIntersection::classify |
( |
const std::string & |
expr | ) |
|
Classifies the facets and keep only the ones on the boundary of a combination of regions defined by a boolean expression.
A facet attribute of type index_t named "operand_bit" indicates for each facet to which operand of a n-ary boolean operation it corresponds to (the same facet might belong to several operands).
- Precondition
- set_radial_sort(true) was set before calling intersect()
- Parameters
-
[in] | expr | the boolean function in ASCII. One can use the following elements, and parentheses:
- Variables: A..Z or x0..x31, correspond to the bits of the "operand_bit" attribute
- the special variable '*' corresponds to the union of everything
- and: '&' or '*'
- or: '|' or '+'
- xor: '^'
- difference: '-'
- not: '!' or '~' Special values for expr:
- "union" (union of everything), synonym of '*'
- "intersection" (intersection of everything).
|
◆ classify_component()
Classifies a connected component.
- Parameters
-
[in] | component | a connected component |
[in] | v | a vertex of the connected component |
- Returns
- the inclusion bits of the connected component relative to the operands
◆ exact_vertex()
Gets the exact point associated with a vertex.
If the vertex has explicit exact coordinates associated with it, they are returned, else an exact ExactPoint is constructed from the double-precision coordinates stored in the mesh
- Parameters
-
[in] | v | a vertex of the mesh |
- Returns
- the exact coordinates of this vertex, as a vector in homogeneous coordinates stored as expansions
◆ find_or_create_exact_vertex()
index_t GEO::MeshSurfaceIntersection::find_or_create_exact_vertex |
( |
const ExactPoint & |
p | ) |
|
|
protected |
Finds or creates a vertex in the mesh, by exact coordinates.
If there is already a vertex with coordinates p
, then the existing vertex is returned, else a new vertex is constructed. Note that only the vertices created by find_or_create_vertex() can be returned as existing vertices. Mesh vertices stored as double- precision coordinates are not retreived by this function.
- Parameters
-
[in] | p | the exact coordinates of a point |
- Returns
- the index of a mesh vertex with
p
as coordinates
◆ intersect()
void GEO::MeshSurfaceIntersection::intersect |
( |
| ) |
|
A facet attribute of type index_t named "operand_bit" can indicate for each facet to which operand of a n-ary boolean operation it corresponds to (the same facet might belong to several operands). It is taken into account by the two variants of mesh_classify_intersections()
◆ intersect_epilogue()
void GEO::MeshSurfaceIntersection::intersect_epilogue |
( |
const vector< IsectInfo > & |
intersections | ) |
|
|
protected |
subset of intersect(), cleans the resulting mesh and undoes optional geometric normalization.
- Parameters
-
[in] | intersections | the vector of IsectInfo. Each IsectInfo is either an intersection vertex or a pair of intersection vertices. Intersection vertices are represented in symbolic form, as a couple of triangle indices plus a couple of triangle subregion id (TriangleRegion). |
find the intersection that landed exactly onto an existing mesh vertex and merges them. Removes the initial triangles that had intersections (they are replaced with new triangles). Merges duplicated triangles that come from coplanar regions. Undoes geometric normalizations. Restores initial symbolic perturbation mode.
◆ intersect_get_intersections()
void GEO::MeshSurfaceIntersection::intersect_get_intersections |
( |
vector< IsectInfo > & |
intersections | ) |
|
|
protected |
substep of intersect(), finds all the intersection points and segments.
- Parameters
-
[out] | intersections | the vector of IsectInfo. Each IsectInfo is either an intersection vertex or a pair of intersection vertices. Intersection vertices are represented in symbolic form, as a couple of triangle indices plus a couple of triangle subregion id (TriangleRegion). |
First uses a MeshFacetsAABB to detect candidate pairs of intersecting triangles, then calls triangles_intersection() in parallel. Finally, mesh facets are shuffled randomly, to ensure balanced multithreading for the subsequent steps.
◆ intersect_prologue()
void GEO::MeshSurfaceIntersection::intersect_prologue |
( |
| ) |
|
|
protected |
substep of intersect(), prepares the mesh
Tesselates the facets if they are not triangulated, creates the operand bit for boolean op classification, removes the exactly degenerate triangles, colocate the points, optionally scales the coordinates and sets symbolic perturbation mode to lexicographic.
◆ intersect_remesh_intersections()
void GEO::MeshSurfaceIntersection::intersect_remesh_intersections |
( |
vector< IsectInfo > & |
intersections | ) |
|
|
protected |
substep of intersect(), inserts the intersection points and segments into the triangles.
- Parameters
-
[in,out] | intersections | the vector of IsectInfo. Each IsectInfo is either an intersection vertex or a pair of intersection vertices. Intersection vertices are represented in symbolic form, as a couple of triangle indices plus a couple of triangle subregion id (TriangleRegion). |
Uses MeshInTriangle, a class derived from CDTBase2d, that computes a constrained Delaunay triangulation with intersection points represented with exact coordinates. Operates in parallel. Each thread computes constrained Delaunay triangulations independently, and commits them in the resulting mesh (with a lock to protect concurrent accesses). The initial mesh is copied (and kept in the mesh_copy_ member), so that concurrent read access do not need a lock.
◆ lock()
void GEO::MeshSurfaceIntersection::lock |
( |
| ) |
|
|
inlineprotected |
Acquires a lock on this mesh.
A single thread can have the lock. When multiple threads want the lock, the ones that do not have it keep waiting until the one that owns the lock calls unlock(). All threads that modify the target mesh should call this function
- See also
- unlock()
Definition at line 338 of file mesh_surface_intersection.h.
◆ readonly_mesh()
const Mesh& GEO::MeshSurfaceIntersection::readonly_mesh |
( |
| ) |
const |
|
inlineprotected |
Gets a copy of the initial mesh passed to the constructor.
It is used by the multithreaded mesh intersection algorithm. Each thread needs to both access the initial geometry and create new vertices and triangles in the target mesh. Creating new mesh elements can reallocate the internal vectors of the mesh, and change the address of the elements. This should not occur while another thread is reading the mesh. Copying the initial geometry in another mesh prevents this type of problems.
- Returns
- a const reference to the mesh that was copied from the one passed to the constructor
Definition at line 402 of file mesh_surface_intersection.h.
◆ remove_external_shell()
void GEO::MeshSurfaceIntersection::remove_external_shell |
( |
| ) |
|
Removes all the facets that are on the outer boundary.
- Precondition
- set_radial_sort(true) was set before calling intersect()
◆ remove_internal_shells()
void GEO::MeshSurfaceIntersection::remove_internal_shells |
( |
| ) |
|
Removes all the facets that are not on the outer boundary.
- Precondition
- set_radial_sort(true) was set before calling intersect()
◆ set_build_skeleton()
void GEO::MeshSurfaceIntersection::set_build_skeleton |
( |
Mesh * |
skeleton, |
|
|
bool |
trim_fins = false |
|
) |
| |
|
inline |
Optionally save the skeleton (that is, the collection of non-manifold edges) to a given mesh.
- Parameters
-
[in] | skeleton | a pointer to the mesh that will receive the skeleton. |
[in] | trim_fins | if set, do not keep bundles that have less than three halfedges. |
Definition at line 253 of file mesh_surface_intersection.h.
◆ set_interpolate_attributes()
void GEO::MeshSurfaceIntersection::set_interpolate_attributes |
( |
bool |
x | ) |
|
|
inline |
Specifies that attributes should be interpolated.
- Parameters
-
[in] | x | true if attributes should be interpolated, false otherwise. Default is false. |
Definition at line 263 of file mesh_surface_intersection.h.
◆ set_monster_threshold()
void GEO::MeshSurfaceIntersection::set_monster_threshold |
( |
index_t |
nb | ) |
|
|
inline |
Sets the threshold from which triangle is considered to be a monster.
Monster triangles are saved to a file for the zoo.
- Parameters
-
[in] | nb | if a triangle has more than nb intersections in it, then it is considered to be a monster. |
Definition at line 190 of file mesh_surface_intersection.h.
◆ set_normalize()
void GEO::MeshSurfaceIntersection::set_normalize |
( |
bool |
x | ) |
|
|
inline |
Specifies whether coordinates should be normalized during computation. If set, original coordinates are restored at the end of intersect().
- Parameters
-
[in] | x | true if coordinates should be normalized. Default is set. |
Definition at line 240 of file mesh_surface_intersection.h.
◆ set_radial_sort()
void GEO::MeshSurfaceIntersection::set_radial_sort |
( |
bool |
x | ) |
|
|
inline |
Specifies whether surfaces should be duplicated and radial edges sorted in order to create the volumetric partition yielded by the intersection.
- Parameters
-
[in] | x | true if radial edges should be sorted. Default is set |
Definition at line 229 of file mesh_surface_intersection.h.
◆ simplify_coplanar_facets()
void GEO::MeshSurfaceIntersection::simplify_coplanar_facets |
( |
double |
angle_tolerance = 0.0 | ) |
|
Merge coplanar facets and retriangulate them using a Constrained Delaunay triangulation.
- Parameters
-
[in] | angle_tolerance | angle tolerance for detecting coplanar facets and colinear edges (in degrees) |
◆ target_mesh() [1/2]
Mesh& GEO::MeshSurfaceIntersection::target_mesh |
( |
| ) |
|
|
inlineprotected |
Gets the target mesh.
- Returns
- a modifiable reference to the mesh that was passed to the constructor
Definition at line 377 of file mesh_surface_intersection.h.
◆ target_mesh() [2/2]
const Mesh& GEO::MeshSurfaceIntersection::target_mesh |
( |
| ) |
const |
|
inlineprotected |
Gets the target mesh.
- Returns
- a const reference to the mesh that was passed to the constructor
Definition at line 386 of file mesh_surface_intersection.h.
◆ tentatively_classify_component_vertex()
index_t GEO::MeshSurfaceIntersection::tentatively_classify_component_vertex |
( |
index_t |
component, |
|
|
index_t |
v |
|
) |
| |
Classifies a vertex of the computed intersection.
- Parameters
-
[in] | component | a component |
[in] | v | a vertex of the component |
- Returns
- the operand inclusion bits, or NO_INDEX if classification was not successful.
Uses raytracing along a random direction. The classification can be not successful if degenerate ray-triangle intersections are encountered. Then one needs to try again.
◆ tentatively_classify_component_vertex_fast()
index_t GEO::MeshSurfaceIntersection::tentatively_classify_component_vertex_fast |
( |
index_t |
component, |
|
|
index_t |
v |
|
) |
| |
Classifies a vertex of the computed intersection.
- Parameters
-
[in] | component | a component |
[in] | v | a vertex of the component |
- Returns
- the operand inclusion bits, or NO_INDEX if classification was not successful.
Uses raytracing along a random direction. The classification can be not successful if degenerate ray-triangle intersections are encountered. Then one needs to try again using tentatively_classify_component_vertex() (multiple times if required).
The documentation for this class was generated from the following file: