Templated tree of axis-aligned bounding boxes (AABB) More...
Public Member Functions | |
AABBTree () | |
Default construct. More... | |
AABBTree (const UList< Type > &objects, const pointField &points, const bool equalBinSize=true, label maxLevel=3, label minBinSize=100) | |
Construct from components. More... | |
const List< treeBoundBox > & | boundBoxes () const noexcept |
Return the bounding boxes making up the tree. More... | |
const List< labelList > & | addressing () const noexcept |
Return the contents addressing. More... | |
bool | pointInside (const point &pt) const |
Determine whether a point is inside the bounding boxes. More... | |
bool | overlaps (const boundBox &bbIn) const |
Determine whether a bounding box overlaps the tree bounding boxes. More... | |
void | writeOBJ (Ostream &os) const |
Write all tree boxes (leaves) in OBJ format. More... | |
Public Member Functions inherited from AABBTreeBase | |
AABBTreeBase ()=default | |
Default construct. More... | |
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. More... | |
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. More... | |
Protected Attributes | |
label | maxLevel_ |
Maximum tree level. More... | |
label | minLeafSize_ |
Minimum points per leaf. More... | |
List< treeBoundBox > | boundBoxes_ |
Bounding boxes making up the tree. More... | |
List< labelList > | addressing_ |
Leaf addressing. More... | |
Friends | |
Istream & | operator>> (Istream &, AABBTree &) |
Ostream & | operator (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. More... | |
Static Protected Attributes inherited from AABBTreeBase | |
static scalar | tolerance_ = 1e-4 |
Relative tolerance. More... | |
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.
Definition at line 55 of file AABBTree.H.
AABBTree | ( | ) |
Default construct.
Definition at line 270 of file AABBTree.C.
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 281 of file AABBTree.C.
References DynamicList< T, SizeMin >::emplace_back(), UList< T >::empty(), Foam::endl(), forAll, Foam::identity(), boundBox::inflate(), Foam::Info, points, DynamicList< T, SizeMin >::push_back(), bitSet::set(), and UList< T >::size().
|
protected |
Write OBJ for all bounding boxes.
Definition at line 29 of file AABBTree.C.
References os(), and Foam::meshTools::writeOBJ().
|
protected |
Create the bounding boxes by interrogating points.
Definition at line 76 of file AABBTree.C.
References boundBox::add(), Foam::component(), DynamicList< T, SizeMin >::emplace_back(), boundBox::inflate(), boundBox::maxDir(), boundBox::min(), points, DynamicList< T, SizeMin >::push_back(), UList< T >::size(), Foam::sort(), and boundBox::span().
|
inlinenoexcept |
Return the bounding boxes making up the tree.
Definition at line 209 of file AABBTree.H.
References AABBTree< Type >::boundBoxes_.
Return the contents addressing.
Definition at line 217 of file AABBTree.H.
References AABBTree< Type >::addressing_.
bool pointInside | ( | const point & | pt | ) | const |
Determine whether a point is inside the bounding boxes.
Definition at line 403 of file AABBTree.C.
References treeBoundBox::contains().
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 treeBoundBox::overlaps().
void writeOBJ | ( | Ostream & | os | ) | const |
Write all tree boxes (leaves) in OBJ format.
Definition at line 390 of file AABBTree.C.
References os(), and AABBTreeBase::writeOBJ().
|
protected |
Maximum tree level.
Definition at line 124 of file AABBTree.H.
|
protected |
Minimum points per leaf.
Definition at line 129 of file AABBTree.H.
|
protected |
Bounding boxes making up the tree.
Definition at line 134 of file AABBTree.H.
Referenced by AABBTree< Type >::boundBoxes().
Leaf addressing.
Definition at line 139 of file AABBTree.H.
Referenced by AABBTree< Type >::addressing().