14#include <lagrange/bvh/AABB.h>
15#include <lagrange/common.h>
16#include <lagrange/utils/function_ref.h>
19#include <Eigen/Geometry>
28template <
typename VertexArray,
typename EdgeArray,
int Dim = 3>
31 using Scalar =
typename VertexArray::Scalar;
32 using Index =
typename EdgeArray::Scalar;
33 using AlignedBoxType =
typename AABB<Scalar, Dim>::Box;
34 using RowVectorType = Eigen::Matrix<Scalar, 1, Dim>;
37 const VertexArray* m_vertices =
nullptr;
38 const EdgeArray* m_edges =
nullptr;
47 EdgeAABBTree() =
default;
62 bool empty()
const {
return m_aabb.empty(); }
73 const RowVectorType& p,
75 RowVectorType& closest_point,
76 Scalar& closest_sq_dist)
const;
114 const RowVectorType& p,
116 RowVectorType& closest_point,
117 Scalar& closest_sq_dist,
118 function_ref<
bool(Index)> filter_func = [](Index) {
return true; })
const;
127#include <lagrange/bvh/EdgeAABBTree.impl.h>
Axis-Aligned Bounding Box (AABB) tree for efficient spatial queries.
Definition AABB.h:39
A lightweight non-owning reference to a callable.
Definition function_ref.h:47
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:151
void get_closest_point(const RowVectorType &p, Index &element_id, RowVectorType &closest_point, Scalar &closest_sq_dist, function_ref< bool(Index)> filter_func=[](Index) { return true;}) const
Gets the closest point to an element of the tree.
Definition EdgeAABBTree.impl.h:213
function_ref< void(Scalar, Index, const RowVectorType &)> ActionCallback
closest_sq_dist x element_id x closest_point
Definition EdgeAABBTree.h:45
bool empty() const
Test whether the tree is empty.
Definition EdgeAABBTree.h:62
void foreach_element_containing(const RowVectorType &p, ActionCallback func) const
Iterate over edges that contain exactly a given query point.
Definition EdgeAABBTree.impl.h:188
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:170
EdgeAABBTree(const VertexArray &V, const EdgeArray &E)
Construct an AABB over the given edge graph.
Definition EdgeAABBTree.impl.h:125
Main namespace for Lagrange.