14#include <lagrange/common.h>
17#include <Eigen/Geometry>
23template <
typename VertexArray,
typename EdgeArray,
int DIM = 3>
26 using Scalar =
typename VertexArray::Scalar;
27 using Index =
typename EdgeArray::Scalar;
28 using AlignedBoxType = Eigen::AlignedBox<Scalar, DIM>;
29 using RowVectorType = Eigen::Matrix<Scalar, 1, DIM>;
35 Index
left = invalid<Index>();
39 bool is_leaf()
const {
return left == invalid<Index>(); }
43 const VertexArray *m_vertices =
nullptr;
44 const EdgeArray *m_edges =
nullptr;
46 std::vector<Node> m_nodes;
51 using ActionCallback = std::function<void(Scalar, Index,
const RowVectorType &)>;
68 bool empty()
const {
return m_nodes.empty(); }
79 const RowVectorType &p,
81 RowVectorType &closest_point,
82 Scalar &closest_sq_dist)
const;
120 const RowVectorType &p,
122 RowVectorType &closest_point,
123 Scalar &closest_sq_dist,
124 std::function<
bool(Index)> filter_func =
nullptr)
const;
127 void foreach_element_in_radius_recursive(
128 const RowVectorType &p,
133 void foreach_element_containing_recursive(
134 const RowVectorType &p,
143#include <lagrange/bvh/EdgeAABBTree.impl.h>
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Definition: EdgeAABBTree.h:32
Index parent
Index of the parent node (INVALID for root).
Definition: EdgeAABBTree.h:34
Index index
Edge id for the leaf (INVALID for internal nodes).
Definition: EdgeAABBTree.h:37
Index right
Index of the right child (INVALID for a leaf).
Definition: EdgeAABBTree.h:36
Index left
Index of the left child (INVALID for a leaf).
Definition: EdgeAABBTree.h:35
Definition: EdgeAABBTree.h:25
void get_element_closest_point(const RowVectorType &p, Index element_id, RowVectorType &closest_point, Scalar &closest_sq_dist) const
Gets the closest point to a given element.
Definition: EdgeAABBTree.impl.h:198
bool empty() const
Test whether the tree is empty.
Definition: EdgeAABBTree.h:68
void foreach_element_containing(const RowVectorType &p, ActionCallback func) const
Iterate over edges that contain exactly a given query point.
Definition: EdgeAABBTree.impl.h:259
void foreach_element_in_radius(const RowVectorType &p, Scalar sq_dist, ActionCallback func) const
Iterate over edges within a prescribed distance from a query point.
Definition: EdgeAABBTree.impl.h:217
std::function< void(Scalar, Index, const RowVectorType &)> ActionCallback
closest_sq_dist x element_id x closest_point
Definition: EdgeAABBTree.h:51
void get_closest_point(const RowVectorType &p, Index &element_id, RowVectorType &closest_point, Scalar &closest_sq_dist, std::function< bool(Index)> filter_func=nullptr) const
Gets the closest point to an element of the tree.
Definition: EdgeAABBTree.impl.h:298