![]() |
AABBtree
0.0.1
A C++ non-recursive ND AABB tree
|
A class representing a non-recursive axis-aligned bounding box tree (AABB tree). More...
#include <Tree.hxx>
Classes | |
| struct | Statistics |
| struct | Node |
Public Member Functions | |
| ~Tree ()=default | |
| Tree ()=default | |
| BoxUniquePtrList const & | boxes () const |
| BoxUniquePtr const & | box (Integer const i) const |
| void | max_dumpings (Integer const max_dumpings) |
| Integer | max_dumpings () const |
| void | max_nodal_objects (Integer const max_nodal_objects) |
| Integer | max_nodal_objects () const |
| void | separation_ratio_tolerance (Real const ratio) |
| Real | separation_ratio_tolerance () const |
| std::vector< Node > const & | structure () const |
| Node const & | node (Integer const i) const |
| Integer | size () const |
| bool | is_empty () const |
| void | clear () |
| void | build (std::unique_ptr< BoxUniquePtrList > boxes_ptr) |
| void | build () |
| template<typename Object> | |
| bool | intersect (Object const &obj, IndexSet &candidates) const |
| bool | intersect (Tree const &tree, IndexMap &candidates) const |
| bool | self_intersect (IndexMap &candidates) const |
| bool | self_intersect (IndexSet &candidates) const |
| template<typename Object> | |
| Real | distance (Object const &obj, IndexSet &candidates) const |
| Real | distance (Tree const &tree, IndexMap &candidates) const |
| template<typename Object, typename Function = std::function< Real(Object const &, Box const &)>> | |
| Real | closest (Object const &obj, Integer const n, IndexSet &candidates, Function distance_function=[](Object const &o, Box const &b) { return b.interior_distance(o);}) const |
| template<typename Object, typename Function = std::function< Real(Object const &, Box const &)>> | |
| bool | within_distance (Object const &obj, Real const max_distance, IndexSet &candidates, Function distance_function=[](Object const &o, Box const &b) { return b.interior_distance(o);}) const |
| void | depth (Integer const i, Integer &d) const |
| void | nodes (Integer const i, Integer &l, Integer &n, Integer &b) const |
| void | stats (Statistics &stats) const |
| void | print (OutStream &os) const |
Private Types | |
| using | Box = AABBtree::Box<Real, N> |
| using | BoxUniquePtr = AABBtree::BoxUniquePtr<Real, N> |
| using | BoxUniquePtrList = AABBtree::BoxUniquePtrList<Real, N> |
| using | Vector = AABBtree::Vector<Real, N> |
| using | Point = AABBtree::Point<Real, N> |
| using | QueueItem = std::tuple<Integer, Integer, Real> |
| using | PriorityQueue |
Private Attributes | |
| std::unique_ptr< BoxUniquePtrList > | m_boxes_ptr |
| std::vector< Node > | m_tree_structure |
| IndexList | m_tree_boxes_map |
| Integer | m_max_dumpings {N} |
| Integer | m_max_nodal_objects {50} |
| Real | m_separation_ratio_tolerance {0.1} |
| Integer | m_node_check_counter {0} |
| Integer | m_long_check_counter {0} |
| Integer | m_objs_check_counter {0} |
| Integer | m_dump_counter {0} |
| IndexList | m_stack |
| PriorityQueue | m_queue |
The Tree class provides an efficient way to store and query a set of axis-aligned bounding boxes non-recursively. It supports various operations such as building the tree, adding axis-aligned boxes, and performing intersection queries. The Tree class is templated on the type of the real numbers and the dimensions of the bounding boxes and is based, as the name suggests, on a novel non-recursive algorithm.
| Real | Type of the scalar coefficients |
| N | Dimension of the ambient space. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
default |
Class destructor for the non-recursive axis-aligned bounding box tree.
|
default |
Class constructor for the non-recursive axis-aligned bounding box tree.
|
inline |
Get a look at the i-th unique pointer to the bounding box.
| [in] | i | Index of the unique pointer to the bounding box. |
|
inline |
Get a look at the vector of unique pointers to the bounding boxes.
|
inline |
Build the tree given the bounding boxes.
|
inline |
Build the tree given the bounding boxes.
| [in] | boxes_ptr | Bounding boxes to build the tree from. |
|
inline |
Clear the tree.
|
inline |
Find the first \( n \) candidates from an object, using a custom distance function.
| [in] | obj | Object to compute the distance to. |
| [in] | n | Number of candidates to find. |
| [out] | candidates | First \( n \) candidates. |
| [in] | distance_function | Custom distance function (default is the interior distance). |
| Object | Type of the object to compute the distance to. |
| Function | Type of the custom distance function. |
|
inline |
Compute the depth of the tree from a given node.
| [in] | i | Index of the node to compute the depth from. |
| [out] | d | Depth of the tree from the given node. |
|
inline |
Compute the minimum distance between an object and the tree.
| [in] | obj | Object to compute the distance to. |
| [out] | candidates | Minimum distance candidates. |
| Object | Type of the object to compute the distance to. |
interior_distance that computes the distance to a box.
|
inline |
Compute the minimum distance between the current tree and another tree.
| [in] | tree | Tree to compute the distance to. |
| [out] | candidates | Minimum distance candidates. |
|
inline |
Intersect the tree with an object.
| [in] | obj | Object to intersect with. |
| [out] | candidates | Intersection result (boxes indexes). |
| Object | Type of the object to intersect with. |
intersects that computes the intersection with a box.
|
inline |
Intersect the tree with another tree.
| [in] | tree | Tree to intersect with. |
| [out] | candidates | Intersection result (boxes indexes). |
|
inline |
Check if tree is empty.
|
inline |
Get the maximum number of dimension dumpings.
|
inline |
Set the maximum number of dimension dumpings.
| [in] | max_dumpings | Maximum number of dimension dumpings. |
|
inline |
Get the maximum number of objects per node.
|
inline |
Set the maximum number of objects per node.
| [in] | max_nodal_objects | Maximum number of objects per node. |
|
inline |
Get the i-th tree node.
| [in] | i | Index of the node. |
|
inline |
Compute the number of leafs, nodes, and long boxes of the tree from a given node.
| [in] | i | Index of the node to start the computation from. |
| [out] | l | Number of leafs of the tree from the given node. |
| [out] | n | Number of nodes of the tree from the given node. |
| [out] | b | Number of long boxes of the tree from the given node. |
|
inline |
Print the tree info to an output stream.
| [in] | os | Output stream to print the tree info to. |
|
inline |
Intersect the tree with itself.
| [out] | candidates | Intersection result (boxes indexes). |
|
inline |
Self-intersect the tree (i.e., intersect the tree with itself to find all the intersecting boxes).
| [out] | candidates | Intersection result (boxes indexes). |
|
inline |
Get the balance ratio tolerance for bounding boxes.
|
inline |
Set the balance ratio tolerance for bounding boxes.
| [in] | ratio | Balance ratio tolerance for bounding boxes. |
|
inline |
Get the number of nodes in the tree.
|
inline |
Compute some statistics about the current tree.
| [out] | stats | Statistics about the tree. |
|
inline |
Get the tree structure.
|
inline |
Find the candidates that are within a given distance from a object, using a custom distance function.
| [in] | obj | Object to compute the distance to. |
| [in] | max_distance | Maximum distance to consider. |
| [out] | candidates | Minimum distance candidates. |
| [in] | distance_function | Custom distance function (default is the interior distance). |
| Object | Type of the object to compute the distance to. |
| Function | Type of the custom distance function. |
|
private |
Vector of unique pointers to the bounding boxes.
|
mutableprivate |
Number of dumpings.
|
mutableprivate |
Long boxes collision checks.
|
private |
Maximum number of dimension dumpings.
|
private |
Maximum number of objects per node.
|
mutableprivate |
Nodes collision checks.
|
mutableprivate |
Objects collision checks.
|
mutableprivate |
Queue for tree traversal.
|
private |
Bounding boxes separation.
|
mutableprivate |
Tree stack.
|
private |
Reordering map between the vector of boxes and the tree internal structure.
|
private |
Tree structure.