Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
treeBoundBox Class Reference

Standard boundBox with extra functionality for use in octree. More...

Inheritance diagram for treeBoundBox:
Inheritance graph
[legend]
Collaboration diagram for treeBoundBox:
Collaboration graph
[legend]

Public Types

enum  octantBit : direction { RIGHTHALF = 0x1, TOPHALF = 0x2, FRONTHALF = 0x4 }
 
enum  faceId {
  LEFT = 0, RIGHT = 1, BOTTOM = 2, TOP = 3,
  BACK = 4, FRONT = 5
}
 
enum  faceBit : direction {
  NOFACE = 0, LEFTBIT = 0x1 << LEFT, RIGHTBIT = 0x1 << RIGHT, BOTTOMBIT = 0x1 << BOTTOM,
  TOPBIT = 0x1 << TOP, BACKBIT = 0x1 << BACK, FRONTBIT = 0x1 << FRONT
}
 
enum  edgeId {
  E01 = 0, E13 = 1, E23 = 2, E02 = 3,
  E45 = 4, E57 = 5, E67 = 6, E46 = 7,
  E04 = 8, E15 = 9, E37 = 10, E26 = 11
}
 
- Public Types inherited from boundBox
enum  directionBit : direction { XDIR = 0x1, YDIR = 0x2, ZDIR = 0x4 }
 

Public Member Functions

 treeBoundBox ()
 
 treeBoundBox (const boundBox &bb)
 
 treeBoundBox (const point &pt)
 
 treeBoundBox (const point &min, const point &max)
 
 treeBoundBox (const UList< point > &points)
 
 treeBoundBox (const UList< point > &points, const labelUList &indices)
 
template<unsigned N>
 treeBoundBox (const UList< point > &points, const FixedList< label, N > &indices)
 
 treeBoundBox (Istream &is)
 
scalar typDim () const
 
tmp< pointFieldpoints () const
 
point corner (const direction octant) const
 
treeBoundBox subBbox (const direction octant) const
 
treeBoundBox subBbox (const point &mid, const direction) const
 
direction subOctant (const point &pt) const
 
direction subOctant (const point &pt, bool &onEdge) const
 
void searchOrder (const point &pt, FixedList< direction, 8 > &octantOrder) const
 
bool intersects (const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
 
bool intersects (const point &start, const point &end, point &pt) const
 
bool contains (const vector &dir, const point &) const
 
direction faceBits (const point &pt) const
 
direction posBits (const point &pt) const
 
void calcExtremities (const point &pt, point &nearest, point &furthest) const
 
scalar maxDist (const point &pt) const
 
label distanceCmp (const point &pt, const treeBoundBox &other) const
 
treeBoundBox extend (Random &rndGen, const scalar s) const
 
bool overlaps (const boundBox &bb) const
 
bool overlaps (const point &centre, const scalar radiusSqr) const
 
bool contains (const point &pt) const
 
bool contains (const boundBox &bb) const
 
bool contains (const UList< point > &points) const
 
template<unsigned N>
bool contains (const UList< point > &points, const FixedList< label, N > &indices) const
 
template<class IntContainer >
bool contains (const UList< point > &points, const IntContainer &indices) const
 
- Public Member Functions inherited from boundBox
 boundBox ()
 
 boundBox (const point &pt)
 
 boundBox (const point &min, const point &max)
 
 boundBox (const UList< point > &points, bool doReduce=true)
 
 boundBox (const tmp< pointField > &tpoints, bool doReduce=true)
 
 boundBox (const UList< point > &points, const labelUList &indices, bool doReduce=true)
 
template<unsigned N>
 boundBox (const UList< point > &points, const FixedList< label, N > &indices, bool doReduce=true)
 
 boundBox (Istream &is)
 
bool empty () const
 
bool valid () const
 
const pointmin () const
 
const pointmax () const
 
pointmin ()
 
pointmax ()
 
point centre () const
 
point midpoint () const
 
vector span () const
 
scalar mag () const
 
scalar volume () const
 
scalar minDim () const
 
scalar maxDim () const
 
scalar avgDim () const
 
label nDim () const
 
tmp< pointFieldpoints () const
 
tmp< pointFieldfaceCentres () const
 
point faceCentre (const direction facei) const
 
void clear ()
 
void add (const boundBox &bb)
 
void add (const point &pt)
 
void add (const UList< point > &points)
 
void add (const tmp< pointField > &tpoints)
 
template<unsigned N>
void add (const FixedList< point, N > &points)
 
template<unsigned N>
void add (const UList< point > &points, const FixedList< label, N > &indices)
 
template<class IntContainer >
void add (const UList< point > &points, const IntContainer &indices)
 
void inflate (const scalar s)
 
void reduce ()
 
bool intersect (const boundBox &bb)
 
bool intersects (const plane &pln) const
 
bool overlaps (const boundBox &bb) const
 
bool overlaps (const point &centre, const scalar radiusSqr) const
 
bool contains (const point &pt) const
 
bool contains (const boundBox &bb) const
 
bool containsInside (const point &pt) const
 
bool contains (const UList< point > &points) const
 
template<unsigned N>
bool contains (const UList< point > &points, const FixedList< label, N > &indices) const
 
template<class IntContainer >
bool contains (const UList< point > &points, const IntContainer &indices) const
 
bool containsAny (const UList< point > &points) const
 
template<unsigned N>
bool containsAny (const UList< point > &points, const FixedList< label, N > &indices) const
 
template<class IntContainer >
bool containsAny (const UList< point > &points, const IntContainer &indices) const
 
point nearest (const point &pt) const
 
void operator+= (const boundBox &bb)
 

Static Public Member Functions

static direction subOctant (const point &mid, const point &pt)
 
static direction subOctant (const point &mid, const point &pt, bool &onEdge)
 
static direction subOctant (const point &mid, const vector &dir, const point &pt, bool &onEdge)
 

Static Public Attributes

static const faceList faces
 
static const edgeList edges
 
- Static Public Attributes inherited from boundBox
static const boundBox greatBox
 
static const boundBox invertedBox
 
static const faceList faces
 
static const FixedList< vector, 6 > faceNormals
 

Friends

Istreamoperator>> (Istream &is, treeBoundBox &bb)
 
Ostreamoperator<< (Ostream &os, const treeBoundBox &bb)
 

Detailed Description

Standard boundBox with extra functionality for use in octree.

Numbering of corner points is according to octant numbering.

On the back plane (z=0):

    Y
    ^
    |
    +--------+
    |2      3|
    |        |
    |        |
    |        |
    |0      1|
    +--------+->X

For the front plane add 4 to the point labels.

Note
When a bounding box is created without any points, it creates an inverted bounding box. Points can be added later and the bounding box will grow to include them.
Source files

Definition at line 82 of file treeBoundBox.H.

Member Enumeration Documentation

◆ octantBit

Enumerator
RIGHTHALF 

1: positive x-direction

TOPHALF 

2: positive y-direction

FRONTHALF 

4: positive z-direction

Definition at line 92 of file treeBoundBox.H.

◆ faceId

enum faceId
Enumerator
LEFT 

0: x-min, left

RIGHT 

1: x-max, right

BOTTOM 

2: y-min, bottom

TOP 

3: y-max, top

BACK 

4: z-min, back

FRONT 

5: z-max, front

Definition at line 101 of file treeBoundBox.H.

◆ faceBit

Enumerator
NOFACE 
LEFTBIT 

1: x-min, left

RIGHTBIT 

2: x-max, right

BOTTOMBIT 

4: y-min, bottom

TOPBIT 

8: y-max, top

BACKBIT 

16: z-min, back

FRONTBIT 

32: z-max, front

Definition at line 112 of file treeBoundBox.H.

◆ edgeId

enum edgeId
Enumerator
E01 
E13 
E23 
E02 
E45 
E57 
E67 
E46 
E04 
E15 
E37 
E26 

Definition at line 125 of file treeBoundBox.H.

Constructor & Destructor Documentation

◆ treeBoundBox() [1/8]

treeBoundBox ( )
inline

Definition at line 27 of file treeBoundBoxI.H.

◆ treeBoundBox() [2/8]

treeBoundBox ( const boundBox bb)
inlineexplicit

Definition at line 33 of file treeBoundBoxI.H.

◆ treeBoundBox() [3/8]

treeBoundBox ( const point pt)
inlineexplicit

Definition at line 39 of file treeBoundBoxI.H.

◆ treeBoundBox() [4/8]

treeBoundBox ( const point min,
const point max 
)
inline

Definition at line 45 of file treeBoundBoxI.H.

◆ treeBoundBox() [5/8]

treeBoundBox ( const UList< point > &  points)
explicit

Definition at line 55 of file treeBoundBox.C.

References Foam::nl, treeBoundBox::points(), and WarningInFunction.

Here is the call graph for this function:

◆ treeBoundBox() [6/8]

treeBoundBox ( const UList< point > &  points,
const labelUList indices 
)

Definition at line 68 of file treeBoundBox.C.

References UList::empty(), Foam::nl, points, and WarningInFunction.

Here is the call graph for this function:

◆ treeBoundBox() [7/8]

treeBoundBox ( const UList< point > &  points,
const FixedList< label, N > &  indices 
)

Definition at line 28 of file treeBoundBoxTemplates.C.

References Foam::nl, points, and WarningInFunction.

◆ treeBoundBox() [8/8]

treeBoundBox ( Istream is)
inline

Definition at line 51 of file treeBoundBoxI.H.

Member Function Documentation

◆ typDim()

Foam::scalar typDim ( ) const
inline

Definition at line 59 of file treeBoundBoxI.H.

◆ points()

Foam::tmp< Foam::pointField > points ( ) const

Definition at line 85 of file treeBoundBox.C.

References forAll, and tmp::New().

Referenced by searchableBox::boundingSpheres(), searchableBox::coordinates(), triangleFuncs::intersectBb(), searchableBox::points(), treeBoundBox::treeBoundBox(), OBJstream::write(), box::writeBoxes(), AABBTree::writeOBJ(), and Foam::meshTools::writeOBJ().

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

◆ corner()

Foam::point corner ( const direction  octant) const
inline

Definition at line 65 of file treeBoundBoxI.H.

References Foam::max(), Foam::min(), x, and y.

Here is the call graph for this function:

◆ subBbox() [1/2]

Foam::treeBoundBox subBbox ( const direction  octant) const

◆ subBbox() [2/2]

Foam::treeBoundBox subBbox ( const point mid,
const direction  octant 
) const

◆ subOctant() [1/5]

Foam::direction subOctant ( const point pt) const
inline

Definition at line 77 of file treeBoundBoxI.H.

Referenced by dynamicIndexedOctree::findNode().

Here is the caller graph for this function:

◆ subOctant() [2/5]

Foam::direction subOctant ( const point mid,
const point pt 
)
inlinestatic

Definition at line 86 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, treeBoundBox::TOPHALF, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ subOctant() [3/5]

Foam::direction subOctant ( const point pt,
bool onEdge 
) const
inline

Definition at line 115 of file treeBoundBoxI.H.

◆ subOctant() [4/5]

Foam::direction subOctant ( const point mid,
const point pt,
bool onEdge 
)
inlinestatic

Definition at line 127 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, treeBoundBox::TOPHALF, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ subOctant() [5/5]

Foam::direction subOctant ( const point mid,
const vector dir,
const point pt,
bool onEdge 
)
inlinestatic

Definition at line 172 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, treeBoundBox::TOPHALF, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ searchOrder()

void searchOrder ( const point pt,
FixedList< direction, 8 > &  octantOrder 
) const
inline

◆ intersects() [1/2]

bool intersects ( const point overallStart,
const vector overallVec,
const point start,
const point end,
point pt,
direction ptBits 
) const

◆ intersects() [2/2]

bool intersects ( const point start,
const point end,
point pt 
) const

Definition at line 302 of file treeBoundBox.C.

References stdFoam::end().

Here is the call graph for this function:

◆ contains() [1/6]

bool contains ( const vector dir,
const point pt 
) const

◆ faceBits()

Foam::direction faceBits ( const point pt) const

Definition at line 351 of file treeBoundBox.C.

References Foam::max(), Foam::min(), x, Vector< Cmpt >::x(), y, Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Referenced by indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findLine().

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

◆ posBits()

Foam::direction posBits ( const point pt) const

◆ calcExtremities()

void calcExtremities ( const point pt,
point nearest,
point furthest 
) const

Definition at line 422 of file treeBoundBox.C.

References Foam::mag(), Foam::max(), Foam::min(), and VectorSpace< Vector< scalar >, scalar, 3 >::nComponents.

Referenced by treeBoundBox::distanceCmp().

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

◆ maxDist()

Foam::scalar maxDist ( const point pt) const

Definition at line 448 of file treeBoundBox.C.

References Foam::mag().

Here is the call graph for this function:

◆ distanceCmp()

Foam::label distanceCmp ( const point pt,
const treeBoundBox other 
) const

Definition at line 458 of file treeBoundBox.C.

References treeBoundBox::calcExtremities(), Foam::sqr(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ extend()

Foam::treeBoundBox extend ( Random rndGen,
const scalar  s 
) const
inline

◆ overlaps() [1/2]

bool overlaps
inline

◆ overlaps() [2/2]

bool overlaps
inline

Definition at line 226 of file boundBoxI.H.

◆ contains() [2/6]

bool contains
inline

Definition at line 264 of file boundBoxI.H.

◆ contains() [3/6]

bool contains
inline

Definition at line 275 of file boundBoxI.H.

◆ contains() [4/6]

bool contains

Definition at line 223 of file boundBox.C.

◆ contains() [5/6]

bool contains ( unsigned  N)
inline

Definition at line 113 of file boundBoxTemplates.C.

◆ contains() [6/6]

bool contains ( class IntContainer  )
inline

Definition at line 142 of file boundBoxTemplates.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream is,
treeBoundBox bb 
)
friend

◆ operator<<

Ostream& operator<< ( Ostream os,
const treeBoundBox bb 
)
friend

Member Data Documentation

◆ faces

const Foam::faceList faces
static

◆ edges

const Foam::edgeList edges
static

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