RINGMesh
Version 5.0.0
A programming library for geological model meshes
|
AABB tree structure. More...
#include <aabb.h>
Public Member Functions | |
index_t | nb_bboxes () const |
template<typename EvalDistance > | |
std::tuple< index_t, vecn< DIMENSION >, double > | closest_element_box (const vecn< DIMENSION > &query, const EvalDistance &action) const |
Gets the closest element box to a point. More... | |
template<class EvalIntersection > | |
void | compute_bbox_element_bbox_intersections (const Box< DIMENSION > &box, EvalIntersection &action) const |
template<class EvalIntersection > | |
void | compute_self_element_bbox_intersections (EvalIntersection &action) const |
Static Public Attributes | |
static const index_t | ROOT_INDEX = 1 |
Protected Member Functions | |
AABBTree ()=default | |
virtual | ~AABBTree ()=default |
void | initialize_tree (const std::vector< Box< DIMENSION > > &bboxes) |
Builds the tree. More... | |
bool | is_leaf (index_t box_begin, index_t box_end) const |
void | get_recursive_iterators (index_t node_index, index_t box_begin, index_t box_end, index_t &middle_box, index_t &child_left, index_t &child_right) const |
const Box< DIMENSION > & | node (index_t i) const |
Box< DIMENSION > & | node (index_t i) |
Protected Attributes | |
std::vector< Box< DIMENSION > > | tree_ {} |
std::vector< index_t > | mapping_morton_ {} |
Private Member Functions | |
ringmesh_disable_copy_and_move (AABBTree) | |
ringmesh_template_assert_2d_or_3d (DIMENSION) | |
index_t | max_node_index (index_t node_index, index_t box_begin, index_t box_end) |
Gets the number of nodes in the tree subset. More... | |
void | initialize_tree_recursive (const std::vector< Box< DIMENSION > > &bboxes, index_t node_index, index_t element_begin, index_t element_end) |
The recursive instruction used in initialize_tree() More... | |
template<typename ACTION > | |
void | closest_element_box_recursive (const vecn< DIMENSION > &query, index_t &nearest_box, vecn< DIMENSION > &nearest_point, double &distance, index_t node_index, index_t element_begin, index_t element_end, const ACTION &action) const |
The recursive instruction used in closest_element_box() More... | |
template<class ACTION > | |
void | bbox_intersect_recursive (const Box< DIMENSION > &box, index_t node_index, index_t element_begin, index_t element_end, ACTION &action) const |
template<class ACTION > | |
void | self_intersect_recursive (index_t node_index1, index_t element_begin1, index_t element_end1, index_t node_index2, index_t element_begin2, index_t element_end2, ACTION &action) const |
std::tuple< index_t, vecn< DIMENSION >, double > | get_nearest_element_box_hint (const vecn< DIMENSION > &query) const |
Gets an hint of the result. More... | |
virtual vecn< DIMENSION > | get_point_hint_from_box (const Box< DIMENSION > &box, index_t element_id) const =0 |
Gets an element point from its box. More... | |
AABB tree structure.
The tree is store in s single vector following this example: ROOT / \ A1 A2 / \ / \ B1 B2 B3 B4 where B* are the input bboxes Storage: |empty|ROOT|A1|A2|B1|B2|B3|B4|
|
protecteddefault |
|
protectedvirtualdefault |
|
private |
|
inline |
Gets the closest element box to a point.
[in] | query | the point to test |
[in] | action | the functor to compute the distance between the query and the tree element boxes |
query
. and nearest_point
. EvalDistance | this functor should have an operator() defined like this: std::tuple< double, vecn< DIMENSION > > operator()( const vecn< DIMENSION >& query, index_t cur_box ) const ; where query is the same than query , cur_box is the element box index (e.g. in the case of SurfaceAABBTree, this index is a polygon index). The returned tuple contains the distance of the nearest point and the nearest point computed using the element in the cur_box . |
|
private |
The recursive instruction used in closest_element_box()
|
inline |
|
inline |
|
private |
|
privatepure virtual |
Gets an element point from its box.
This function is used to get a result from the selected hint box
Implemented in RINGMesh::VolumeAABBTree< DIMENSION >, RINGMesh::SurfaceAABBTree< DIMENSION >, RINGMesh::LineAABBTree< DIMENSION >, and RINGMesh::BoxAABBTree< DIMENSION >.
|
inlineprotected |
|
protected |
|
private |
The recursive instruction used in initialize_tree()
Computes the hierarchy of bounding boxes recursively.
[in] | bboxes | the array of bounding boxes |
[in] | node_index | the index of the root of the subtree |
[in] | box_begin | first box index in the vector bboxes |
[in] | box_end | one position past the last box index in the vector bboxes |
|
inlineprotected |
|
private |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
private |
|
private |
|
private |
|
protected |
|
static |
|
protected |