|
Lagrange
|
AABB tree for a triangle mesh. More...
#include <lagrange/bvh/TriangleAABBTree.h>
Public Types | |
| using | AlignedBoxType = typename AABB<Scalar, Dim>::Box |
| using | RowVectorType = Eigen::Matrix<Scalar, 1, Dim> |
| using | ActionCallback = function_ref<void(Scalar, Index, const RowVectorType&)> |
| Callback signature: (squared_distance, triangle_id, closest_point) | |
Public Member Functions | |
| TriangleAABBTree (const SurfaceMesh< Scalar, Index > &mesh) | |
| Construct an AABB tree over the given triangle mesh. | |
| bool | empty () const |
| Test whether the tree is empty. | |
| void | foreach_triangle_in_radius (const RowVectorType &p, Scalar sq_dist, ActionCallback func) const |
| Iterate over triangles within a prescribed distance from a query point. | |
| bool | get_closest_point (const RowVectorType &p, Index &triangle_id, RowVectorType &closest_point, Scalar &closest_sq_dist) const |
| Gets the nearest triangle to a query point using automatic hint optimization. | |
AABB tree for a triangle mesh.
This data structure organizes triangles in a spatial hierarchy to enable efficient geometric queries such as closest point, ray intersection, and spatial containment tests.
| Scalar | Scalar type for coordinates. |
| Index | Index type for triangle indices. |
| Dim | Spatial Dimension (typically 3). |
| TriangleAABBTree | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
Construct an AABB tree over the given triangle mesh.
| [in] | mesh | Input surface mesh. |
|
inline |
Test whether the tree is empty.
| void foreach_triangle_in_radius | ( | const RowVectorType & | p, |
| Scalar | sq_dist, | ||
| ActionCallback | func ) const |
Iterate over triangles within a prescribed distance from a query point.
| [in] | p | 1 x Dim query point. |
| [in] | sq_dist | Squared query radius. |
| [in] | func | Function to apply to every triangle within query distance. |
| bool get_closest_point | ( | const RowVectorType & | p, |
| Index & | triangle_id, | ||
| RowVectorType & | closest_point, | ||
| Scalar & | closest_sq_dist ) const |
Gets the nearest triangle to a query point using automatic hint optimization.
This is an optimized version that automatically finds a good starting triangle based on bounding box centers to potentially reduce search time.
| [in] | p | Query point. |
| [out] | triangle_id | Nearest triangle id. |
| [out] | closest_point | Closest point on the triangle. |
| [out] | closest_sq_dist | Squared distance between closest point and query point. |