Graphite  Version 3
An experimental 3D geometry processing program
GEO::MeshFacetsAABB2d Class Reference

Axis Aligned Bounding Box tree of mesh facets in 2D. More...

#include <geogram/mesh/mesh_AABB.h>

Inheritance diagram for GEO::MeshFacetsAABB2d:
GEO::MeshAABB2d GEO::AABB< BOX >

Public Member Functions

 MeshFacetsAABB2d ()
 MeshFacetsAABB2d constructor. More...
 
 MeshFacetsAABB2d (Mesh &M, bool reorder=true)
 Creates the Axis Aligned Bounding Boxes tree. More...
 
void initialize (Mesh &M, bool reorder=true)
 Initializes the Axis Aligned Bounding Boxes tree. More...
 
index_t containing_triangle (const vec2 &p) const
 Finds the index of a facet that contains a query point. More...
 
void compute_bbox_cell_bbox_intersections (const Box2d &box_in, std::function< void(index_t)> action) const
 Computes all the intersections between a given box and the bounding boxes of all the facets. More...
 
void containing_boxes (const vec2 &p, std::function< void(index_t)> action) const
 Finds all the cells such that their bounding box contain a point. More...
 
void compute_facet_bbox_intersections (std::function< void(index_t, index_t)> action) const
 Computes all the pairs of intersecting facets. More...
 
void compute_other_cell_bbox_intersections (MeshFacetsAABB2d *other, std::function< void(index_t, index_t)> action) const
 Computes all the pairs of intersecting cells between this AABB and another one. More...
 
- Public Member Functions inherited from GEO::MeshAABB2d
 MeshAABB2d ()
 MeshAABB2d constructor.
 
const Meshmesh () const
 Gets the mesh. More...
 

Static Public Attributes

static const index_t NO_TRIANGLE = index_t(-1)
 Symbolic constant for indicating that there is no containing tetrahedron. More...
 

Protected Member Functions

index_t containing_triangle_recursive (const vec2 &p, index_t n, index_t b, index_t e) const
 The recursive function used by the implementation of containing_triangle(). More...
 
void containing_bboxes_recursive (std::function< void(index_t)> action, const vec2 &p, index_t node, index_t b, index_t e) const
 Computes all the cells that have a bbox that contain a given point in a sub-tree of the AABB tree. More...
 
- Protected Member Functions inherited from GEO::AABB< BOX >
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...
 

Additional Inherited Members

- Static Protected Member Functions inherited from GEO::AABB< BOX >
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 inherited from GEO::MeshAABB2d
Meshmesh_
 
- Protected Attributes inherited from GEO::AABB< BOX >
index_t nb_
 
vector< BOX > bboxes_
 

Detailed Description

Axis Aligned Bounding Box tree of mesh facets in 2D.

Used to quickly find the facet that contains a given 2d point.

Definition at line 924 of file mesh_AABB.h.

Constructor & Destructor Documentation

◆ MeshFacetsAABB2d() [1/2]

GEO::MeshFacetsAABB2d::MeshFacetsAABB2d ( )

MeshFacetsAABB2d constructor.

Creates an uninitialized MeshFacetsAABB2d.

◆ MeshFacetsAABB2d() [2/2]

GEO::MeshFacetsAABB2d::MeshFacetsAABB2d ( Mesh M,
bool  reorder = true 
)

Creates the Axis Aligned Bounding Boxes tree.

Parameters
[in]Mthe input mesh. It can be modified, The cells are re-ordered (using Morton's order, see mesh_reorder()).
[in]reorderif not set, Morton re-ordering is skipped (but it means that mesh_reorder() was previously called else the algorithm will be pretty unefficient).

Member Function Documentation

◆ compute_bbox_cell_bbox_intersections()

void GEO::MeshFacetsAABB2d::compute_bbox_cell_bbox_intersections ( const Box2d box_in,
std::function< void(index_t)>  action 
) const
inline

Computes all the intersections between a given box and the bounding boxes of all the facets.

Parameters
[in]actiona function that takes as argument an index_t (cell index) invoked for all cells that have a bounding box that intersects box_in.

Definition at line 982 of file mesh_AABB.h.

◆ compute_facet_bbox_intersections()

void GEO::MeshFacetsAABB2d::compute_facet_bbox_intersections ( std::function< void(index_t, index_t)>  action) const
inline

Computes all the pairs of intersecting facets.

Parameters
[in]actionis a function that takes two index_t's, invoked of all pairs of cells that have overlapping bounding boxes. Further processing is necessary to detect actual cell intersections.

Definition at line 1013 of file mesh_AABB.h.

◆ compute_other_cell_bbox_intersections()

void GEO::MeshFacetsAABB2d::compute_other_cell_bbox_intersections ( MeshFacetsAABB2d other,
std::function< void(index_t, index_t)>  action 
) const
inline

Computes all the pairs of intersecting cells between this AABB and another one.

Parameters
[in]actionis a function that takes two index_t's, invoked of all pairs of cells that have overlapping bounding boxes. Further processing is necessary to detect actual cell intersections.
[in]otherthe other AABB.

Definition at line 1032 of file mesh_AABB.h.

◆ containing_bboxes_recursive()

void GEO::MeshFacetsAABB2d::containing_bboxes_recursive ( std::function< void(index_t)>  action,
const vec2 p,
index_t  node,
index_t  b,
index_t  e 
) const
inlineprotected

Computes all the cells that have a bbox that contain a given point 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 facets contained in the two nodes are sent as well as the node indices.

Parameters
[in]actiona function that takes an index_t that is invoked for all cells that has a bounding box that contains p.
[in]pa const reference to the query point
[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 1082 of file mesh_AABB.h.

◆ containing_boxes()

void GEO::MeshFacetsAABB2d::containing_boxes ( const vec2 p,
std::function< void(index_t)>  action 
) const
inline

Finds all the cells such that their bounding box contain a point.

Parameters
[in]actiona function that takes an index_t that is invoked for all cells that have a bounding box that contains p.

Definition at line 998 of file mesh_AABB.h.

◆ containing_triangle()

index_t GEO::MeshFacetsAABB2d::containing_triangle ( const vec2 p) const
inline

Finds the index of a facet that contains a query point.

Parameters
[in]pa const reference to the query point
Returns
the index of one of the facetthat contains p or NO_TRIANGLE if p is outside the mesh.
Note
The input mesh needs to be triangulated. If the mesh has arbitrary cells, then one may use instead containing_boxes().

Definition at line 968 of file mesh_AABB.h.

◆ containing_triangle_recursive()

index_t GEO::MeshFacetsAABB2d::containing_triangle_recursive ( const vec2 p,
index_t  n,
index_t  b,
index_t  e 
) const
protected

The recursive function used by the implementation of containing_triangle().

Parameters
[in]pa const reference to the query point
[in]nindex of the current node in the AABB tree
[in]bindex of the first tet in the subtree under node n
[in]eone position past the index of the last tet in the subtree under node n
Returns
the index of one of the tetrahedra that contains p, or NO_TRIANGLE if p is outside the mesh.

◆ initialize()

void GEO::MeshFacetsAABB2d::initialize ( Mesh M,
bool  reorder = true 
)

Initializes the Axis Aligned Bounding Boxes tree.

Parameters
[in]Mthe input mesh. It can be modified, The cells are re-ordered (using Morton's order, see mesh_reorder()).
[in]reorderif not set, Morton re-ordering is skipped (but it means that mesh_reorder() was previously called else the algorithm will be pretty unefficient).

Member Data Documentation

◆ NO_TRIANGLE

const index_t GEO::MeshFacetsAABB2d::NO_TRIANGLE = index_t(-1)
static

Symbolic constant for indicating that there is no containing tetrahedron.

See also
containing_tet()

Definition at line 932 of file mesh_AABB.h.


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