Utility for querying point containment against a closed triangulated surface mesh. More...
#include <TriangleManifold.h>
Public Member Functions | |
| TriangleManifold (MeshBase &mesh, const Real surface_tolerance) | |
| Build a manifold classifier from a prepared surface mesh. More... | |
| bool | contains (const Point &point) const |
| const libMesh::BoundingBox & | boundingBox () const |
| std::size_t | numTriangles () const |
Private Types | |
| enum | RayIntersection { RayIntersection::Miss, RayIntersection::Hit, RayIntersection::Ambiguous } |
| Result of intersecting the positive x-direction ray with a triangle. More... | |
Private Member Functions | |
| void | finalize () |
| Complete post-parse validation and acceleration-structure setup. More... | |
| void | buildCandidateGrid () |
| Build the yz-plane lookup grid used to accelerate +x ray queries. More... | |
| bool | pointInsideBoundingBox (const Point &point) const |
| Cheap global bounding-box rejection for containment queries. More... | |
| bool | pointOnSurface (const Point &point) const |
| Detect whether a query point lies on or extremely near the manifold surface. More... | |
| RayIntersection | rayIntersectsTriangle (const Point &point, const libMesh::Elem &tri) const |
| Intersect a positive x-direction ray with a single triangle. More... | |
| bool | containsBySolidAngle (const Point &point) const |
| Robust fallback containment query based on accumulated solid angle. More... | |
| std::vector< dof_id_type > | rayCandidates (const Point &point) const |
| Get the subset of triangles whose yz extents may intersect the query ray. More... | |
Private Attributes | |
| std::size_t | _num_y_cells = 1 |
| Number of yz-grid bins in the y direction. More... | |
| std::size_t | _num_z_cells = 1 |
| Number of yz-grid bins in the z direction. More... | |
| Real | _y_min = 0.0 |
| Minimum global y coordinate used to map query points into yz-grid bins. More... | |
| Real | _z_min = 0.0 |
| Minimum global z coordinate used to map query points into yz-grid bins. More... | |
| Real | _y_cell_size = 1.0 |
| Width of one yz-grid cell in the y direction. More... | |
| Real | _z_cell_size = 1.0 |
| Width of one yz-grid cell in the z direction. More... | |
| std::unordered_map< dof_id_type, std::vector< dof_id_type > > | _ray_grid |
| Lookup from packed yz-grid cell index to triangles that could intersect the +x query ray. More... | |
| MeshBase & | _mesh |
| const Real | _surface_tolerance |
| Absolute tolerance used throughout validation and geometric classification. More... | |
| const libMesh::BoundingBox | _bounding_box |
| Global bounding box of the transformed manifold. More... | |
| const std::unique_ptr< libMesh::PointLocatorBase > | _point_locator |
| Pre-built point locator for fast proximity-to-surface detection. More... | |
Utility for querying point containment against a closed triangulated surface mesh.
The class takes ownership of a reference to a prepared 2D surface mesh, validates that it forms a closed 2-manifold (every triangle has exactly three neighbors, all elements are Tri3, and the mesh is consistently oriented), builds a lightweight yz-plane acceleration grid, and exposes contains() for point-in-solid queries.
Containment is resolved in three stages:
surface_tolerance of the mesh surface are treated as inside).The referenced mesh must outlive this object. Any geometric transforms (scale, rotation, translation) should be applied to the mesh before constructing a TriangleManifold.
Definition at line 44 of file TriangleManifold.h.
|
strongprivate |
Result of intersecting the positive x-direction ray with a triangle.
Ambiguous is returned when the hit is too close to an edge, vertex, or the ray origin. In that case we abandon parity counting and fall back to the more expensive but robust solid-angle test.
| Enumerator | |
|---|---|
| Miss | |
| Hit | |
| Ambiguous | |
Definition at line 81 of file TriangleManifold.h.
| TriangleManifold::TriangleManifold | ( | MeshBase & | mesh, |
| const Real | surface_tolerance | ||
| ) |
Build a manifold classifier from a prepared surface mesh.
| mesh | Serialized 2D surface mesh that defines the closed manifold. Must outlive this object. Any desired transforms should already be applied to the mesh. |
| surface_tolerance | Absolute tolerance used for manifold validation and near-surface classification. Choose this relative to the mesh length scale and expected coordinate noise from the export pipeline. |
Definition at line 56 of file TriangleManifold.C.
|
inline |
Definition at line 66 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), pointInsideBoundingBox(), and rayCandidates().
|
private |
Build the yz-plane lookup grid used to accelerate +x ray queries.
Definition at line 128 of file TriangleManifold.C.
Referenced by finalize().
| bool TriangleManifold::contains | ( | const Point & | point | ) | const |
Definition at line 73 of file TriangleManifold.C.
Referenced by ManifoldSubdomainGenerator::generate().
|
private |
Robust fallback containment query based on accumulated solid angle.
Definition at line 241 of file TriangleManifold.C.
Referenced by contains().
|
private |
Complete post-parse validation and acceleration-structure setup.
Definition at line 112 of file TriangleManifold.C.
Referenced by TriangleManifold().
|
inline |
Definition at line 71 of file TriangleManifold.h.
Referenced by buildCandidateGrid().
|
private |
Cheap global bounding-box rejection for containment queries.
Definition at line 174 of file TriangleManifold.C.
Referenced by contains().
|
private |
Detect whether a query point lies on or extremely near the manifold surface.
Definition at line 186 of file TriangleManifold.C.
Referenced by contains().
|
private |
Get the subset of triangles whose yz extents may intersect the query ray.
Definition at line 254 of file TriangleManifold.C.
Referenced by contains().
|
private |
Intersect a positive x-direction ray with a single triangle.
Definition at line 192 of file TriangleManifold.C.
Referenced by contains().
|
private |
Global bounding box of the transformed manifold.
Definition at line 136 of file TriangleManifold.h.
Referenced by boundingBox().
|
private |
Definition at line 130 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), contains(), containsBySolidAngle(), finalize(), and numTriangles().
|
private |
Number of yz-grid bins in the y direction.
Definition at line 110 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Number of yz-grid bins in the z direction.
Definition at line 113 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Pre-built point locator for fast proximity-to-surface detection.
Definition at line 139 of file TriangleManifold.h.
Referenced by pointOnSurface(), and TriangleManifold().
|
private |
Lookup from packed yz-grid cell index to triangles that could intersect the +x query ray.
Definition at line 128 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Absolute tolerance used throughout validation and geometric classification.
Definition at line 133 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), contains(), pointInsideBoundingBox(), rayCandidates(), rayIntersectsTriangle(), and TriangleManifold().
|
private |
Width of one yz-grid cell in the y direction.
Definition at line 122 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Minimum global y coordinate used to map query points into yz-grid bins.
Definition at line 116 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Width of one yz-grid cell in the z direction.
Definition at line 125 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
|
private |
Minimum global z coordinate used to map query points into yz-grid bins.
Definition at line 119 of file TriangleManifold.h.
Referenced by buildCandidateGrid(), and rayCandidates().
1.8.14