Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::AABB< BOX > Class Template Reference

Base class for Axis Aligned Bounding Box trees. More...

#include <geogram/mesh/mesh_AABB.h>

Inheritance diagram for GEO::AABB< BOX >:
GEO::MeshAABB2d GEO::MeshAABB3d GEO::MeshFacetsAABB2d GEO::MeshCellsAABB GEO::MeshFacetsAABB

Protected Member Functions

void initialize (index_t nb, std::function< void(BOX &, index_t)> get_bbox)
 Initializes this AABB. More...
 
void bbox_intersect_recursive (std::function< void(index_t)> action, const BOX &box, index_t node, index_t b, index_t e) const
 Computes all the elements that have a bbox that intersects a given bbox in a sub-tree of the AABB tree. More...
 
void self_intersect_recursive (std::function< void(index_t, index_t)> action, index_t node1, index_t b1, index_t e1, index_t node2, index_t b2, index_t e2) const
 Computes all the pairs of intersecting elements for two sub-trees of the AABB tree. More...
 
void other_intersect_recursive (std::function< void(index_t, index_t)> action, index_t node1, index_t b1, index_t e1, const AABB< BOX > *other, index_t node2, index_t b2, index_t e2) const
 Computes all the pairs of intersecting elements for two sub-trees of two AABB trees. More...
 
void init_bboxes_recursive (index_t node_index, index_t b, index_t e, std::function< void(BOX &, index_t)> get_bbox)
 Computes the hierarchy of bounding boxes recursively. More...
 

Static Protected Member Functions

static index_t max_node_index (index_t node_index, index_t b, index_t e)
 Computes the maximum node index in a subtree. More...
 

Protected Attributes

index_t nb_
 
vector< BOX > bboxes_
 

Detailed Description

template<class BOX>
class GEO::AABB< BOX >

Base class for Axis Aligned Bounding Box trees.

Template Parameters
BOXthe box class (Box2d or Box3d).

Definition at line 60 of file mesh_AABB.h.

Member Function Documentation

◆ bbox_intersect_recursive()

template<class BOX >
void GEO::AABB< BOX >::bbox_intersect_recursive ( std::function< void(index_t)>  action,
const BOX &  box,
index_t  node,
index_t  b,
index_t  e 
) const
inlineprotected

Computes all the elements that have a bbox that intersects a given bbox in a sub-tree of the AABB tree.

Note that the tree structure is completely implicit, therefore the bounds of the (continuous) facet indices sequences that correspond to the elements contained in the two nodes are sent as well as the node indices.

Parameters
[in]actiona function that takes as argument an index_t (cell index) invoked for all cells that has a bounding box that overlaps box.
[in]boxthe query box
[in]nodeindex of the first node of the AABB tree
[in]bindex of the first facet in node
[in]eone position past the index of the last facet in node

Definition at line 96 of file mesh_AABB.h.

◆ init_bboxes_recursive()

template<class BOX >
void GEO::AABB< BOX >::init_bboxes_recursive ( index_t  node_index,
index_t  b,
index_t  e,
std::function< void(BOX &, index_t)>  get_bbox 
)
inlineprotected

Computes the hierarchy of bounding boxes recursively.

This function is generic and can be used to compute a bbox hierarchy of arbitrary elements.

Parameters
[in]node_indexthe index of the root of the subtree
[in]bfirst element index in the subtree
[in]eone position past the last element index in the subtree
[in]get_bboxa function that takes a Box3d& and an index_t, that computes the bbox of an element.

Definition at line 291 of file mesh_AABB.h.

◆ initialize()

template<class BOX >
void GEO::AABB< BOX >::initialize ( index_t  nb,
std::function< void(BOX &, index_t)>  get_bbox 
)
inlineprotected

Initializes this AABB.

Parameters
[in]nbnumber of items.
[in]get_bboxa function(Box&, index_t) that computes the Box associated with a given index, in [0..nb-1].

Definition at line 70 of file mesh_AABB.h.

◆ max_node_index()

template<class BOX >
static index_t GEO::AABB< BOX >::max_node_index ( index_t  node_index,
index_t  b,
index_t  e 
)
inlinestaticprotected

Computes the maximum node index in a subtree.

Parameters
[in]node_indexnode index of the root of the subtree
[in]bfirst facet index in the subtree
[in]eone position past the last facet index in the subtree
Returns
the maximum node index in the subtree rooted at node_index

Definition at line 267 of file mesh_AABB.h.

◆ other_intersect_recursive()

template<class BOX >
void GEO::AABB< BOX >::other_intersect_recursive ( std::function< void(index_t, index_t)>  action,
index_t  node1,
index_t  b1,
index_t  e1,
const AABB< BOX > *  other,
index_t  node2,
index_t  b2,
index_t  e2 
) const
inlineprotected

Computes all the pairs of intersecting elements for two sub-trees of two AABB trees.

Note that the tree structure is completely implicit, therefore the bounds of the (continuous) facet indices sequences that correspond to the elementss contained in the two nodes are sent as well as the node indices.

Parameters
[in]actiona function taking as arguments two index_t's, invoked of all pairs of elements that have overlapping bounding boxes.
[in]node1index of the first node of the AABB tree
[in]b1index of the first facet in node1
[in]e1one position past the index of the last facet in node1
[in]otherthe second AABB tree
[in]node2index of the second node of the second AABB tree
[in]b2index of the first facet in node2
[in]e2one position past the index of the second facet in node2

Definition at line 212 of file mesh_AABB.h.

◆ self_intersect_recursive()

template<class BOX >
void GEO::AABB< BOX >::self_intersect_recursive ( std::function< void(index_t, index_t)>  action,
index_t  node1,
index_t  b1,
index_t  e1,
index_t  node2,
index_t  b2,
index_t  e2 
) const
inlineprotected

Computes all the pairs of intersecting elements for two sub-trees of the AABB tree.

Note that the tree structure is completely implicit, therefore the bounds of the (continuous) facet indices sequences that correspond to the elementss contained in the two nodes are sent as well as the node indices.

Parameters
[in]actiona function taking as arguments two index_t's, invoked of all pairs of elements that have overlapping bounding boxes.
[in]node1index of the first node of the AABB tree
[in]b1index of the first facet in node1
[in]e1one position past the index of the last facet in node1
[in]node2index of the second node of the AABB tree
[in]b2index of the first facet in node2
[in]e2one position past the index of the second facet in node2

Definition at line 143 of file mesh_AABB.h.


The documentation for this class was generated from the following file: