AABBTree< Type > Class Template Reference

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

Collaboration diagram for AABBTree< Type >:
[legend]

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
 

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< treeBoundBoxboundBoxes_
 Bounding boxes making up the tree. More...
 
List< labelListaddressing_
 Leaf addressing. More...
 

Static Protected Attributes

static scalar tolerance_ = 1e-4
 Tolerance. More...
 

Friends

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

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 59 of file AABBTree.H.

Constructor & Destructor Documentation

◆ AABBTree() [1/2]

AABBTree ( )

Null constructor.

Definition at line 322 of file AABBTree.C.

◆ AABBTree() [2/2]

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

Definition at line 333 of file AABBTree.C.

References DynamicList< T, SizeMin >::append(), UList< T >::empty(), Foam::endl(), forAll, Foam::identity(), boundBox::inflate(), Foam::Info, points, bitSet::set(), and UList< T >::size().

Here is the call graph for this function:

Member Function Documentation

◆ writeOBJ() [1/2]

void writeOBJ ( const bool  writeLinesOnly,
const treeBoundBox bb,
label &  vertI,
Ostream os 
) const
protected

Write OBJ file of bounding box.

Definition at line 41 of file AABBTree.C.

References Foam::constant::electromagnetic::e, treeBoundBox::edges, f(), treeBoundBox::faces, Foam::nl, os(), treeBoundBox::points(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ writeOBJ() [2/2]

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 80 of file AABBTree.C.

References os(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ createBoxes()

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
protected

Create the bounding boxes by interrogating points.

Definition at line 127 of file AABBTree.C.

References DynamicList< T, SizeMin >::append(), Foam::component(), Foam::divide(), boundBox::min(), points, DynamicList< T, SizeMin >::shrink(), Foam::sort(), and boundBox::span().

Here is the call graph for this function:

◆ boundBoxes()

const Foam::List< Foam::treeBoundBox > & boundBoxes ( ) const

Return the bounding boxes making up the tree.

Definition at line 442 of file AABBTree.C.

Referenced by faceAreaWeightAMI2D::overlappingTgtFaces().

Here is the caller graph for this function:

◆ addressing()

const Foam::List< Foam::labelList > & addressing ( ) const

Return the contents addressing.

Definition at line 449 of file AABBTree.C.

Referenced by faceAreaWeightAMI2D::overlappingTgtFaces().

Here is the caller graph for this function:

◆ pointInside()

bool pointInside ( const point pt) const

Determine whether a point is inside the bounding boxes.

Definition at line 456 of file AABBTree.C.

References treeBoundBox::contains().

Here is the call graph for this function:

◆ overlaps()

bool overlaps ( const boundBox bbIn) const

Determine whether a bounding box overlaps the tree bounding boxes

Definition at line 471 of file AABBTree.C.

References treeBoundBox::overlaps().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

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

◆ operator

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

Member Data Documentation

◆ tolerance_

Foam::scalar tolerance_ = 1e-4
staticprotected

Tolerance.

Definition at line 80 of file AABBTree.H.

◆ maxLevel_

label maxLevel_
protected

Maximum tree level.

Definition at line 83 of file AABBTree.H.

◆ minLeafSize_

label minLeafSize_
protected

Minimum points per leaf.

Definition at line 86 of file AABBTree.H.

◆ boundBoxes_

List<treeBoundBox> boundBoxes_
protected

Bounding boxes making up the tree.

Definition at line 89 of file AABBTree.H.

◆ addressing_

List<labelList> addressing_
protected

Leaf addressing.

Definition at line 92 of file AABBTree.H.


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