Lagrange
EdgeAABBTree< VertexArray, EdgeArray, DIM > Struct Template Reference

Classes

struct  Node
 

Public Types

using Scalar = typename VertexArray::Scalar
 
using Index = typename EdgeArray::Scalar
 
using AlignedBoxType = Eigen::AlignedBox< Scalar, DIM >
 
using RowVectorType = Eigen::Matrix< Scalar, 1, DIM >
 
using ActionCallback = std::function< void(Scalar, Index, const RowVectorType &)>
 closest_sq_dist x element_id x closest_point
 

Public Member Functions

 EdgeAABBTree (const VertexArray &V, const EdgeArray &E)
 Construct an AABB over the given edge graph. More...
 
bool empty () const
 Test whether the tree is empty. More...
 
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. More...
 
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. More...
 
void foreach_element_containing (const RowVectorType &p, ActionCallback func) const
 Iterate over edges that contain exactly a given query point. More...
 
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. More...
 

Protected Member Functions

void foreach_element_in_radius_recursive (const RowVectorType &p, Scalar sq_dist, Index node_id, ActionCallback func) const
 
void foreach_element_containing_recursive (const RowVectorType &p, Index node_id, ActionCallback func) const
 

Constructor & Destructor Documentation

◆ EdgeAABBTree()

EdgeAABBTree ( const VertexArray &  V,
const EdgeArray &  E 
)

Construct an AABB over the given edge graph.

Parameters
[in]V#V x DIM input vertex positions.
[in]E#E x 2 input edge vertices.

Member Function Documentation

◆ empty()

bool empty ( ) const
inline

Test whether the tree is empty.

Returns
True iff empty, False otherwise.

◆ get_element_closest_point()

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.

Parameters
[in]pQuery point.
[in]element_idElement id.
[out]closest_pointClosest point on the element.
[out]closest_sq_distSquared distance between closest point and query point.

◆ foreach_element_in_radius()

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.

Parameters
[in]p1 x DIM query point.
[in]sq_distSquared query radius.
[in]funcFunction to apply to every edge within query distance.

◆ foreach_element_containing()

void foreach_element_containing ( const RowVectorType &  p,
ActionCallback  func 
) const

Iterate over edges that contain exactly a given query point.

This function uses exact predicates to determine whether the query point belong to an edge segment. Note that this is slightly different from calling foreach_element_in_radius with a search radius of 0, since foreach_element_in_radius does not use exact predicates, it might return false positives (i.e. points which are at distance 0, but not exactly collinear).

Parameters
[in]p1 x DIM query point.
[in]funcFunction to apply to every edge within query distance.

◆ get_closest_point()

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.

Whereas get_element_closest_point returns the closest point to a queried element, this function recursively traverses the tree nodes to find the element which is closest to the query point.

Parameters
[in]pQuery point.
[out]element_idClosest element id.
[out]closest_pointClosest point on the element.
[out]closest_sq_distSquared distance between closest point and query point.
[in]filter_funcOptional function to filter out elements from the test. Only elements for which filter_func(element_id) == true will be considered for closest point.

The documentation for this struct was generated from the following files: