Loading...
Searching...
No Matches
AABBTree< Type > Class Template Reference

Templated tree of axis-aligned bounding boxes (AABB). More...

#include <AABBTree.H>

Inheritance diagram for AABBTree< Type >:
Collaboration diagram for AABBTree< Type >:

Public Member Functions

 AABBTree ()
 Default construct.
 AABBTree (const UList< Type > &objects, const pointField &points, const bool equalBinSize=true, label maxLevel=3, label minBinSize=100)
 Construct from components.
const List< treeBoundBox > & boundBoxes () const noexcept
 Return the bounding boxes making up the tree.
const List< labelList > & addressing () const noexcept
 Return the contents addressing.
bool pointInside (const point &pt) const
 Determine whether a point is inside the bounding boxes.
bool overlaps (const boundBox &bbIn) const
 Determine whether a bounding box overlaps the tree bounding boxes.
void writeOBJ (Ostream &os) const
 Write all tree boxes (leaves) in OBJ format.
Public Member Functions inherited from AABBTreeBase
 AABBTreeBase ()=default
 Default construct.

Protected Member Functions

void writeOBJ (const bool leavesOnly, const bool writeLinesOnly, const treeBoundBox &bb, const label nodeI, const List< Pair< treeBoundBox > > &bbs, const List< Pair< label > > &nodes, label &vertI, Ostream &os) const
 Write OBJ for all bounding boxes.
void createBoxes (const bool equalBinSize, const label level, const UList< Type > &objects, const pointField &points, const labelUList &objectIDs, const treeBoundBox &bb, const label nodeI, DynamicList< Pair< treeBoundBox > > &bbs, DynamicList< labelPair > &nodes, DynamicList< labelList > &addressing) const
 Create the bounding boxes by interrogating points.

Protected Attributes

label maxLevel_
 Maximum tree level.
label minLeafSize_
 Minimum points per leaf.
List< treeBoundBoxboundBoxes_
 Bounding boxes making up the tree.
List< labelListaddressing_
 Leaf addressing.

Friends

Istreamoperator>> (Istream &, AABBTree &)
Ostreamoperator<< (Ostream &, const AABBTree &)

Additional Inherited Members

Static Public Member Functions inherited from AABBTreeBase
static void writeOBJ (Ostream &os, const treeBoundBox &bb, label &vertIndex, const bool writeLinesOnly=false)
 Write treeBoundBox in OBJ format.
Static Protected Attributes inherited from AABBTreeBase
static scalar tolerance_ = 1e-4
 Relative tolerance.

Detailed Description

template<class Type>
class Foam::AABBTree< Type >

Templated tree of axis-aligned bounding boxes (AABB).

Designed to be templated on either faces or cells, the AABBTree will decompose the input into a tree of AABB's. The maximum number of tree levels and minimum number of objects per leaf are provided on construction, and the contents (addressing) is stored.

Source files

Definition at line 113 of file AABBTree.H.

Constructor & Destructor Documentation

◆ AABBTree() [1/2]

template<class Type>
AABBTree ( )

Default construct.

Definition at line 270 of file AABBTree.C.

References addressing_, boundBoxes_, maxLevel_, and minLeafSize_.

Referenced by operator<<, and operator>>.

Here is the caller graph for this function:

◆ AABBTree() [2/2]

template<class Type>
AABBTree ( const UList< Type > & objects,
const pointField & points,
const bool equalBinSize = true,
label maxLevel = 3,
label minBinSize = 100 )

Construct from components.

equalBinSize: divide into equal number of elements or equal span

Definition at line 280 of file AABBTree.C.

References addressing(), addressing_, boundBoxes(), boundBoxes_, bitSet::count(), createBoxes(), DynamicList< T, SizeMin >::emplace_back(), UList< T >::empty(), Foam::endl(), forAll, Foam::identity(), boundBox::inflate(), Foam::Info, maxLevel_, minLeafSize_, points, bitSet::set(), and UList< T >::size().

Here is the call graph for this function:

Member Function Documentation

◆ writeOBJ() [1/2]

template<class Type>
void writeOBJ ( const bool leavesOnly,
const bool writeLinesOnly,
const treeBoundBox & bb,
const label nodeI,
const List< Pair< treeBoundBox > > & bbs,
const List< Pair< label > > & nodes,
label & vertI,
Ostream & os ) const
protected

Write OBJ for all bounding boxes.

Definition at line 28 of file AABBTree.C.

References os(), writeOBJ(), and AABBTreeBase::writeOBJ().

Referenced by writeOBJ().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createBoxes()

template<class Type>
void createBoxes ( const bool equalBinSize,
const label level,
const UList< Type > & objects,
const pointField & points,
const labelUList & objectIDs,
const treeBoundBox & bb,
const label nodeI,
DynamicList< Pair< treeBoundBox > > & bbs,
DynamicList< labelPair > & nodes,
DynamicList< labelList > & addressing ) const
protected

◆ boundBoxes()

template<class Type>
const List< treeBoundBox > & boundBoxes ( ) const
inlinenoexcept

Return the bounding boxes making up the tree.

Definition at line 209 of file AABBTree.H.

References boundBoxes_, and Foam::noexcept.

Referenced by AABBTree().

Here is the caller graph for this function:

◆ addressing()

template<class Type>
const List< labelList > & addressing ( ) const
inlinenoexcept

Return the contents addressing.

Definition at line 217 of file AABBTree.H.

References addressing_, and Foam::noexcept.

Referenced by AABBTree(), and createBoxes().

Here is the caller graph for this function:

◆ pointInside()

template<class Type>
bool pointInside ( const point & pt) const

Determine whether a point is inside the bounding boxes.

Definition at line 403 of file AABBTree.C.

References boundBoxes_.

◆ overlaps()

template<class Type>
bool overlaps ( const boundBox & bbIn) const

Determine whether a bounding box overlaps the tree bounding boxes.

Definition at line 418 of file AABBTree.C.

References boundBoxes_.

◆ writeOBJ() [2/2]

template<class Type>
void writeOBJ ( Ostream & os) const

Write all tree boxes (leaves) in OBJ format.

Definition at line 390 of file AABBTree.C.

References boundBoxes_, os(), and AABBTreeBase::writeOBJ().

Here is the call graph for this function:

◆ operator>>

template<class Type>
Istream & operator>> ( Istream & ,
AABBTree< Type > &  )
friend

References AABBTree().

◆ operator<<

template<class Type>
Ostream & operator<< ( Ostream & ,
const AABBTree< Type > &  )
friend

References AABBTree().

Member Data Documentation

◆ maxLevel_

template<class Type>
label maxLevel_
protected

Maximum tree level.

Definition at line 124 of file AABBTree.H.

Referenced by AABBTree(), AABBTree(), and createBoxes().

◆ minLeafSize_

template<class Type>
label minLeafSize_
protected

Minimum points per leaf.

Definition at line 129 of file AABBTree.H.

Referenced by AABBTree(), AABBTree(), and createBoxes().

◆ boundBoxes_

template<class Type>
List<treeBoundBox> boundBoxes_
protected

Bounding boxes making up the tree.

Definition at line 134 of file AABBTree.H.

Referenced by AABBTree(), AABBTree(), boundBoxes(), overlaps(), pointInside(), and writeOBJ().

◆ addressing_

template<class Type>
List<labelList> addressing_
protected

Leaf addressing.

Definition at line 139 of file AABBTree.H.

Referenced by AABBTree(), AABBTree(), and addressing().


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