Templated tree of axis-aligned bounding boxes (AABB) More...
Public Member Functions | |
AABBTree () | |
Null constructor. More... | |
AABBTree (const UList< Type > &objects, const pointField &points, const bool equalBinSize=true, const label maxLevel=3, const label minBinSize=100) | |
Construct from components. More... | |
const List< treeBoundBox > & | boundBoxes () const |
Return the bounding boxes making up the tree. More... | |
const List< labelList > & | addressing () const |
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. More... | |
Protected Member Functions | |
void | writeOBJ (const bool writeLinesOnly, const treeBoundBox &bb, label &vertI, Ostream &os) const |
Write OBJ file of bounding box. More... | |
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 List< Type > &objects, const pointField &points, const DynamicList< label > &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 adressing. More... | |
Static Protected Attributes | |
static scalar | tolerance_ = 1e-4 |
Tolerance. More... | |
Friends | |
Istream & | operator>> (Istream &, AABBTree &) |
Ostream & | operator (Ostream &, const AABBTree &) |
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 57 of file AABBTree.H.
AABBTree | ( | ) |
Null constructor.
Definition at line 329 of file AABBTree.C.
AABBTree | ( | const UList< Type > & | objects, |
const pointField & | points, | ||
const bool | equalBinSize = true , |
||
const label | maxLevel = 3 , |
||
const label | minBinSize = 100 |
||
) |
Construct from components.
equalBinSize: divide into equal number of elements or equal span
|
protected |
Write OBJ file of bounding box.
Definition at line 38 of file AABBTree.C.
References Foam::constant::electromagnetic::e, treeBoundBox::edges, f(), treeBoundBox::faces, forAll, Foam::nl, treeBoundBox::points(), and writeOBJ().
|
protected |
Write OBJ for all bounding boxes.
Definition at line 80 of file AABBTree.C.
References writeOBJ().
|
protected |
Create the bounding boxes by interrogating points.
Definition at line 127 of file AABBTree.C.
References DynamicList::append(), Foam::component(), Foam::divide(), forAll, boundBox::inflate(), boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), points, PackedBoolList::set(), DynamicList::shrink(), Foam::sort(), and boundBox::span().
const Foam::List< Foam::treeBoundBox > & boundBoxes | ( | ) | const |
Return the bounding boxes making up the tree.
Definition at line 428 of file AABBTree.C.
Referenced by AMIInterpolation< SourcePatch, TargetPatch >::calcProcMap(), and meshToMesh::calcProcMap().
const Foam::List< Foam::labelList > & addressing | ( | ) | const |
Return the contents addressing.
Definition at line 435 of file AABBTree.C.
bool pointInside | ( | const point & | pt | ) | const |
Determine whether a point is inside the bounding boxes.
Definition at line 442 of file AABBTree.C.
References treeBoundBox::contains(), and forAll.
bool overlaps | ( | const boundBox & | bbIn | ) | const |
Determine whether a bounding box overlaps the tree bounding.
boxes
Definition at line 459 of file AABBTree.C.
References forAll, and treeBoundBox::overlaps().
|
staticprotected |
Tolerance.
Definition at line 78 of file AABBTree.H.
|
protected |
Maximum tree level.
Definition at line 81 of file AABBTree.H.
|
protected |
Minimum points per leaf.
Definition at line 84 of file AABBTree.H.
|
protected |
Bounding boxes making up the tree.
Definition at line 87 of file AABBTree.H.
Leaf adressing.
Definition at line 90 of file AABBTree.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.