treeBoundBox Class Reference

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

Inheritance diagram for treeBoundBox:
Collaboration diagram for treeBoundBox:

Public Types

enum  octantBit : direction { RIGHTHALF = 1, TOPHALF = 2, FRONTHALF = 4 }
 Bits used for octant/point directional encoding. More...
 
enum  faceId : direction {
  LEFT = 0, RIGHT = 1, BOTTOM = 2, TOP = 3,
  BACK = 4, FRONT = 5
}
 Face codes. Identical order and meaning as per hex cellmodel and boundBox, but have a different point ordering. More...
 
enum  faceBit : direction {
  NOFACE = 0, LEFTBIT = (1 << LEFT), RIGHTBIT = (1 << RIGHT), BOTTOMBIT = (1 << BOTTOM),
  TOPBIT = (1 << TOP), BACKBIT = (1 << BACK), FRONTBIT = (1 << FRONT)
}
 Bits used for face encoding. More...
 
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
}
 Edges codes. More...
 
- Public Types inherited from boundBox
enum  directionBit : direction { XDIR = 1, YDIR = 2, ZDIR = 4 }
 Bits used for (x/y/z) directional encoding. More...
 

Public Member Functions

 treeBoundBox ()=default
 Default construct: an inverted bounding box. More...
 
 treeBoundBox (const treeBoundBox &)=default
 Copy construct. More...
 
treeBoundBoxoperator= (const treeBoundBox &)=default
 Copy assignment. More...
 
 treeBoundBox (const boundBox &bb)
 Copy construct from a boundBox. More...
 
void operator= (const boundBox &bb)
 Copy assignment from a boundBox. More...
 
 treeBoundBox (const Foam::zero_one)
 Construct a 0/1 unit bounding box. More...
 
 treeBoundBox (const point &p)
 Construct a bounding box containing a single initial point. More...
 
 treeBoundBox (const point &min, const point &max)
 Construct from bound box min/max points. More...
 
 treeBoundBox (const Pair< point > &bb)
 Construct from bound box min/max points. More...
 
 treeBoundBox (const UList< point > &points)
 Construct as the bounding box of the given pointField. More...
 
 treeBoundBox (const UList< point > &points, const labelUList &indices)
 Construct as subset of points. More...
 
template<unsigned N>
 treeBoundBox (const UList< point > &points, const FixedList< label, N > &indices)
 Construct as subset of points. More...
 
 treeBoundBox (Istream &is)
 Construct from Istream. More...
 
tmp< pointFieldpoints () const
 Vertex coordinates. In octant coding. More...
 
point corner (const direction octant) const
 Corner point of given octant. More...
 
treeBoundBox subBbox (const direction octant) const
 Sub-box of given octant. Midpoint calculated. More...
 
treeBoundBox subBbox (const point &mid, const direction) const
 Sub-box given by octant number. Midpoint provided. More...
 
treeBoundBox subHalf (const direction whichFace) const
 Sub-box half for given face. More...
 
treeBoundBox subHalf (const scalar mid, const direction whichFace) const
 Sub-box half for given face with prescribed mid point value. Eg, subHalf(scalar, LEFT) More...
 
direction subOctant (const point &pt) const
 Returns octant number given point and the calculated midpoint. More...
 
direction subOctant (const point &pt, bool &onEdge) const
 Returns octant number given point and the calculated midpoint. More...
 
void searchOrder (const point &pt, FixedList< direction, 8 > &octantOrder) const
 Calculates optimal order to look for nearest to point. More...
 
FixedList< direction, 8 > searchOrder (const point &pt) const
 Return optimal search order to look for nearest to point. More...
 
bool subOverlaps (const direction octant, const boundBox &bb) const
 Does sub-octant overlap/touch boundingBox? More...
 
bool subOverlaps (const direction octant, const point &centre, const scalar radiusSqr) const
 Does sub-octant overlap boundingSphere (centre + sqr(radius))? More...
 
bool intersects (const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
 Intersects segment; set point to intersection position and face,. More...
 
bool intersects (const point &start, const point &end, point &pt) const
 Like above but does not return faces point is on. More...
 
bool intersects (const linePointRef &ln, point &pt) const
 Like above but does not return faces point is on. More...
 
bool contains (const vector &dir, const point &) const
 Contains point (inside or on edge) and moving in direction. More...
 
direction faceBits (const point &pt) const
 Code position of point on bounding box faces. More...
 
direction posBits (const point &pt) const
 Position of point relative to bounding box. More...
 
void calcExtremities (const point &pt, point &nearest, point &furthest) const
 Calculate nearest and furthest (to point) vertex coords of. More...
 
scalar maxDist (const point &pt) const
 Returns distance point to furthest away corner. More...
 
label distanceCmp (const point &pt, const treeBoundBox &other) const
 Compare distance to point with other bounding box. More...
 
treeBoundBox extend (Random &rndGen, const scalar s) const
 Return slightly wider bounding box. More...
 
treeBoundBox extend (Random &rndGen, const scalar s, const scalar delta) const
 As per two parameter version but with additional grow() by given amount in each dimension. More...
 
scalar typDim () const
 Typical dimension length,height,width. Identical to avgDim() More...
 
bool overlaps (const boundBox &bb) const
 Overlaps with other bounding box, sphere etc? More...
 
bool overlaps (const point &centre, const scalar radiusSqr) const
 Overlaps with other bounding box, sphere etc? More...
 
bool intersects (const plane &pln) const
 intersects other bounding box, sphere etc? More...
 
bool intersects (const triPointRef &tri) const
 intersects other bounding box, sphere etc? More...
 
bool contains (const point &pt) const
 Contains point or other bounding box? More...
 
bool contains (const boundBox &bb) const
 Contains point or other bounding box? More...
 
bool contains (const UList< point > &points) const
 Contains point or other bounding box? More...
 
template<unsigned N>
bool contains (const UList< point > &points, const FixedList< label, N > &indices) const
 Contains point or other bounding box? More...
 
template<class IntContainer >
bool contains (const UList< point > &points, const IntContainer &indices) const
 Contains point or other bounding box? More...
 
- Public Member Functions inherited from boundBox
 boundBox ()
 Default construct: an inverted bounding box. More...
 
 boundBox (const boundBox &)=default
 Copy construct. More...
 
boundBoxoperator= (const boundBox &)=default
 Copy assignment. More...
 
 boundBox (const boundBox &bb, bool doReduce)
 Copy construct with specified global reduction. More...
 
 boundBox (const point &p)
 Construct a bounding box containing a single initial point. More...
 
 boundBox (const Foam::zero_one)
 Construct a 0/1 unit bounding box. More...
 
 boundBox (const point &min, const point &max)
 Construct from bound box min/max points. More...
 
 boundBox (const Pair< point > &bb)
 Construct from bound box min/max points. More...
 
 boundBox (const UList< point > &points, bool doReduce=true)
 Construct as the bounding box of the given points. More...
 
 boundBox (const tmp< pointField > &tpoints, bool doReduce=true)
 Construct as the bounding box of the given temporary pointField. More...
 
 boundBox (const UList< point > &points, const labelUList &indices, bool doReduce=true)
 Construct bounding box as an indirect subset of the points. More...
 
template<unsigned N>
 boundBox (const UList< point > &points, const FixedList< label, N > &indices, bool doReduce=true)
 Construct bounding box as an indirect subset of the points. More...
 
 boundBox (Istream &is)
 Construct from Istream. More...
 
bool empty () const
 Bounding box is inverted, contains no points. More...
 
bool good () const
 Bounding box is non-inverted. More...
 
bool valid () const
 Bounding box is non-inverted - same as good(). More...
 
const pointmin () const noexcept
 Minimum describing the bounding box. More...
 
const pointmax () const noexcept
 Maximum describing the bounding box. More...
 
pointmin () noexcept
 Minimum describing the bounding box, non-const access. More...
 
pointmax () noexcept
 Maximum describing the bounding box, non-const access. More...
 
point centre () const
 The centre (midpoint) of the bounding box. More...
 
vector span () const
 The bounding box span (from minimum to maximum) More...
 
scalar mag () const
 The magnitude/length of the bounding box diagonal. More...
 
scalar magSqr () const
 The magnitude/length squared of bounding box diagonal. More...
 
scalar volume () const
 The volume of the bound box. More...
 
scalar minDim () const
 Smallest length/height/width dimension. More...
 
scalar maxDim () const
 Largest length/height/width dimension. More...
 
scalar avgDim () const
 Average length/height/width dimension. More...
 
direction minDir () const
 Direction (X/Y/Z) of the smallest span (for empty box: 0) More...
 
direction maxDir () const
 Direction (X/Y/Z) of the largest span (for empty box: 0) More...
 
int nDim () const
 Count the number of positive, non-zero dimensions. More...
 
template<direction CornerNumber>
point hexCorner () const
 Return corner point [0..7] corresponding to a 'hex' cell. More...
 
tmp< pointFieldhexCorners () const
 Corner points in an order corresponding to a 'hex' cell. More...
 
tmp< pointFieldpoints () const
 Corner points in an order corresponding to a 'hex' cell. More...
 
tmp< pointFieldfaceCentres () const
 Face midpoints. More...
 
point faceCentre (const direction facei) const
 Face centre of given face index. More...
 
void reset ()
 Reset to an inverted box. More...
 
void reset (const Foam::zero_one)
 Reset to a 0/1 unit bounding box. More...
 
void reset (const point &pt)
 Reset min/max to be identical to the specified point. More...
 
void reset (const point &min, const point &max)
 Reset min/max to specified values. More...
 
void clear ()
 Same as reset() - reset to an inverted box. More...
 
void add (const boundBox &bb)
 Extend to include the second box. More...
 
void add (const point &pt)
 Extend to include the point. More...
 
void add (const point &pt0, const point &pt1)
 Extend to include two additional points. More...
 
void add (const Pair< point > &points)
 Extend to include two additional points. More...
 
void add (const UList< point > &points)
 Extend to include the points. More...
 
void add (const tmp< pointField > &tpoints)
 Extend to include the points from the temporary point field. More...
 
template<unsigned N>
void add (const FixedList< point, N > &points)
 Extend to include the points. More...
 
template<unsigned N>
void add (const UList< point > &points, const FixedList< label, N > &indices)
 Extend to include a (subsetted) point field. More...
 
template<class IntContainer >
void add (const UList< point > &points, const IntContainer &indices)
 Extend to include a (subsetted) point field. More...
 
void grow (const scalar delta)
 Expand box by adjusting min/max by specified amount in each dimension. More...
 
void grow (const vector &delta)
 Expand box by adjusting min/max by specified amounts. More...
 
void inflate (const scalar factor)
 Expand box by factor*mag(span) in all dimensions. More...
 
void inflate (Random &rndGen, const scalar factor)
 Expand box slightly by expanding all dimensions with factor*span*(random 0-1) and guarantees factor*mag(span) minimum width in any direction. More...
 
void inflate (Random &r, const scalar factor, const scalar delta)
 As per two parameter version but with additional grow() by given amount in each dimension. More...
 
void reduce ()
 Inplace parallel reduction of min/max values. More...
 
bool intersects (const plane &pln) const
 Does plane intersect this bounding box. More...
 
bool intersects (const triPointRef &tri) const
 Does triangle intersect this bounding box or is contained within this bounding box. More...
 
bool overlaps (const boundBox &bb) const
 Overlaps/touches boundingBox? More...
 
bool overlaps (const point &centre, const scalar radiusSqr) const
 Overlaps boundingSphere (centre + sqr(radius))? More...
 
bool contains (const point &pt) const
 Contains point? (inside or on edge) More...
 
bool contains (const boundBox &bb) const
 Fully contains other boundingBox? More...
 
bool containsInside (const point &pt) const
 Contains point? (inside only) More...
 
bool contains (const UList< point > &points) const
 Contains all points? (inside or on edge) More...
 
template<unsigned N>
bool contains (const UList< point > &points, const FixedList< label, N > &indices) const
 Contains all of the (subsetted) points? (inside or on edge) More...
 
template<class IntContainer >
bool contains (const UList< point > &points, const IntContainer &indices) const
 Contains all of the (subsetted) points? (inside or on edge) More...
 
bool containsAny (const UList< point > &points) const
 Contains any of the points? (inside or on edge) More...
 
template<unsigned N>
bool containsAny (const UList< point > &points, const FixedList< label, N > &indices) const
 Contains any of the (subsetted) points? (inside or on edge) More...
 
template<class IntContainer >
bool containsAny (const UList< point > &points, const IntContainer &indices) const
 Contains any of the (subsetted) points? (inside or on edge) More...
 
point nearest (const point &p) const
 Return the nearest point on the boundBox to the supplied point. More...
 
void operator &= (const boundBox &bb)
 Restrict min/max to union with other box. More...
 
void operator+= (const boundBox &bb)
 Extend box to include the second box, as per the add() method. More...
 
bool intersect (const boundBox &bb)
 Deprecated(2022-10) - use 'operator&=' to avoid confusion with other intersects() methods. More...
 
point midpoint () const
 Identical to centre() More...
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<>
Foam::point hexCorner () const
 
template<Foam::direction CornerNumber>
Foam::point hexCorner () const
 

Static Public Member Functions

static const treeBoundBoxnull () noexcept
 The null treeBoundBox is the same as an inverted box. More...
 
static direction subOctant (const point &mid, const point &pt)
 Returns octant number given point and midpoint. More...
 
static direction subOctant (const point &mid, const point &pt, bool &onEdge)
 Returns octant number given point and midpoint. More...
 
static direction subOctant (const point &mid, const vector &dir, const point &pt, bool &onEdge)
 Returns octant number given intersection and midpoint. More...
 
- Static Public Member Functions inherited from boundBox
static const boundBoxnull () noexcept
 The null boundBox is the same as an inverted box. More...
 
static const Foam::faceListhexFaces ()
 The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces() More...
 
static constexpr label nPoints () noexcept
 Number of points for boundBox and HEX. More...
 
static constexpr label nEdges () noexcept
 Number of edges for boundBox and HEX. More...
 
static constexpr label nFaces () noexcept
 Number of faces for boundBox and HEX. More...
 
static boundBox returnReduce (const boundBox &bb)
 Perform a reduction on a copy and return the result. More...
 

Static Public Attributes

static const faceList faces
 Face to point addressing, using octant corner points. More...
 
static const edgeList edges
 Edge to point addressing, using octant corner points. More...
 
- Static Public Attributes inherited from boundBox
static const boundBox greatBox
 A large boundBox: min/max == -/+ ROOTVGREAT. More...
 
static const boundBox invertedBox
 A large inverted boundBox: min/max == +/- ROOTVGREAT. More...
 
static const FixedList< vector, 6 > faceNormals
 The unit normal per face. More...
 

Friends

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

Additional Inherited Members

- Static Protected Member Functions inherited from boundBox
static bool box_box_overlaps (const point &minA, const point &maxA, const point &minB, const point &maxB)
 Test for overlap of box and box (inclusive check) More...
 
static bool box_sphere_overlaps (const point &corner0, const point &corner1, const point &centre, const scalar radiusSqr)
 Test for overlap of box and boundingSphere (centre + sqr(radius)) More...
 

Detailed Description

Standard boundBox with extra functionality for use in octree.

Numbering of corner points is according to octant numbering as shown below. For vertex numbering in the sequence 0 to 7:

  • faces 0 and 1 are x-min and x-max, respectively;
  • faces 2 and 3 are y-min and y-max, respectively;
  • faces 4 and 5 are z-min and z-max, respectively.
Octant vertex ordering               | Hex cell ordering
(treeBoundBox)                       | (boundBox, blockMesh, hexCell)
                                     |
                6 ---- 7             |         7 ---- 6
          f5    |\     :\    f3      |   f5    |\     :\    f3
           |    | 4 ---- 5    \      |    |    | 4 ---- 5    \
           |    2.|....3 |     \     |    |    3.|....2 |     \
           |     \|     \|     f2    |    |     \|     \|     f2
          f4      0 ---- 1           |   f4      0 ---- 1
  Y  Z                               |
   \ |          f0 ------ f1         |         f0 ------ f1
    \|                               |
     o--- X                          |
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.
See also
Foam::boundBox
Source files

Definition at line 90 of file treeBoundBox.H.

Member Enumeration Documentation

◆ octantBit

Bits used for octant/point directional encoding.

Every octant/corner point is the combination of three directions. Defined as (1 << vector::components).

Enumerator
RIGHTHALF 

1: positive x-direction

TOPHALF 

2: positive y-direction

FRONTHALF 

4: positive z-direction

Definition at line 104 of file treeBoundBox.H.

◆ faceId

enum faceId : direction

Face codes. Identical order and meaning as per hex cellmodel and boundBox, but have a different point ordering.

Defined as (2 * vector::components + positive).

Enumerator
LEFT 

0: x-min face

RIGHT 

1: x-max face

BOTTOM 

2: y-min face

TOP 

3: y-max face

BACK 

4: z-min face

FRONT 

5: z-max face

Definition at line 117 of file treeBoundBox.H.

◆ faceBit

Bits used for face encoding.

Defined as (1 << (2 * vector::components + positive)). For example, the positive Z-face: (1 << (2 * vector::Z + 1))

Enumerator
NOFACE 

0: none

LEFTBIT 

1: x-min face

RIGHTBIT 

2: x-max face

BOTTOMBIT 

4: y-min face

TOPBIT 

8: y-max face

BACKBIT 

16: z-min face

FRONTBIT 

32: z-max face

Definition at line 134 of file treeBoundBox.H.

◆ edgeId

enum edgeId

Edges codes.

E01 = edge between 0 and 1.

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

Definition at line 150 of file treeBoundBox.H.

Constructor & Destructor Documentation

◆ treeBoundBox() [1/11]

treeBoundBox ( )
default

Default construct: an inverted bounding box.

◆ treeBoundBox() [2/11]

treeBoundBox ( const treeBoundBox )
default

Copy construct.

◆ treeBoundBox() [3/11]

treeBoundBox ( const boundBox bb)
inlineexplicit

Copy construct from a boundBox.

Definition at line 214 of file treeBoundBox.H.

◆ treeBoundBox() [4/11]

treeBoundBox ( const Foam::zero_one  )
inlineexplicit

Construct a 0/1 unit bounding box.

Definition at line 27 of file treeBoundBoxI.H.

◆ treeBoundBox() [5/11]

treeBoundBox ( const point p)
inlineexplicit

Construct a bounding box containing a single initial point.

Definition at line 33 of file treeBoundBoxI.H.

◆ treeBoundBox() [6/11]

treeBoundBox ( const point min,
const point max 
)
inline

Construct from bound box min/max points.

Definition at line 39 of file treeBoundBoxI.H.

◆ treeBoundBox() [7/11]

treeBoundBox ( const Pair< point > &  bb)
inlineexplicit

Construct from bound box min/max points.

TBD: Construct from bound box min/max points inline explicit treeBoundBox(const MinMax<point>& bb);

Definition at line 45 of file treeBoundBoxI.H.

◆ treeBoundBox() [8/11]

treeBoundBox ( const UList< point > &  points)
explicit

Construct as the bounding box of the given pointField.

Local processor domain only (no reduce as in boundBox)

Definition at line 57 of file treeBoundBox.C.

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

Here is the call graph for this function:

◆ treeBoundBox() [9/11]

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

Construct as subset of points.

Local processor domain only (no reduce as in boundBox)

Definition at line 70 of file treeBoundBox.C.

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

Here is the call graph for this function:

◆ treeBoundBox() [10/11]

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

Construct as subset of points.

The indices could be from edge/triFace etc. Local processor domain only (no reduce as in boundBox)

Definition at line 28 of file treeBoundBoxTemplates.C.

References Foam::nl, points, and WarningInFunction.

◆ treeBoundBox() [11/11]

treeBoundBox ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 51 of file treeBoundBoxI.H.

Member Function Documentation

◆ null()

static const treeBoundBox& null ( )
inlinestaticnoexcept

The null treeBoundBox is the same as an inverted box.

Definition at line 187 of file treeBoundBox.H.

References boundBox::invertedBox.

Referenced by dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::bb(), and indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::bb().

Here is the caller graph for this function:

◆ operator=() [1/2]

treeBoundBox& operator= ( const treeBoundBox )
default

Copy assignment.

◆ operator=() [2/2]

void operator= ( const boundBox bb)
inline

Copy assignment from a boundBox.

Definition at line 219 of file treeBoundBox.H.

◆ points()

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

Vertex coordinates. In octant coding.

Definition at line 87 of file treeBoundBox.C.

References forAll, tmp< T >::New(), and pts.

Referenced by searchableBox::boundingSpheres(), searchableBox::coordinates(), triangleFuncs::intersectBb(), searchableBox::points(), treeBoundBox::treeBoundBox(), OBJstream::write(), AABBTreeBase::writeOBJ(), Foam::meshTools::writeOBJ(), and indexedOctreeBase::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

Corner point of given octant.

Definition at line 59 of file treeBoundBoxI.H.

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

Here is the call graph for this function:

◆ subBbox() [1/2]

◆ subBbox() [2/2]

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

Sub-box given by octant number. Midpoint provided.

Definition at line 102 of file treeBoundBox.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, treeBoundBox::FRONTHALF, boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), treeBoundBox::RIGHTHALF, and treeBoundBox::TOPHALF.

Here is the call graph for this function:

◆ subHalf() [1/2]

Foam::treeBoundBox subHalf ( const direction  whichFace) const

Sub-box half for given face.

Definition at line 185 of file treeBoundBox.C.

References Foam::max(), Foam::min(), and Y.

Here is the call graph for this function:

◆ subHalf() [2/2]

Foam::treeBoundBox subHalf ( const scalar  mid,
const direction  whichFace 
) const

Sub-box half for given face with prescribed mid point value. Eg, subHalf(scalar, LEFT)

Definition at line 151 of file treeBoundBox.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, boundBox::max(), and boundBox::min().

Here is the call graph for this function:

◆ subOctant() [1/5]

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

Returns octant number given point and the calculated midpoint.

Definition at line 71 of file treeBoundBoxI.H.

Referenced by dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::findNode(), and indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findNode().

Here is the caller graph for this function:

◆ subOctant() [2/5]

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

Returns octant number given point and midpoint.

Definition at line 80 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, and treeBoundBox::TOPHALF.

◆ subOctant() [3/5]

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

Returns octant number given point and the calculated midpoint.

onEdge set if the point is on edge of subOctant

Definition at line 109 of file treeBoundBoxI.H.

◆ subOctant() [4/5]

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

Returns octant number given point and midpoint.

onEdge set if the point is on edge of subOctant

Definition at line 121 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, and treeBoundBox::TOPHALF.

◆ subOctant() [5/5]

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

Returns octant number given intersection and midpoint.

onEdge set if the point is on edge of subOctant If onEdge, the direction vector determines which octant to use (acc. to which octant the point would be if it were moved along dir)

Definition at line 166 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, treeBoundBox::RIGHTHALF, and treeBoundBox::TOPHALF.

◆ searchOrder() [1/2]

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

Calculates optimal order to look for nearest to point.

First will be the octant containing the point, second the octant with boundary nearest to the point etc.

Definition at line 220 of file treeBoundBoxI.H.

References treeBoundBox::FRONTHALF, Foam::max(), Foam::min(), treeBoundBox::RIGHTHALF, and treeBoundBox::TOPHALF.

Referenced by dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::findNearest(), and indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findNearest().

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

◆ searchOrder() [2/2]

Foam::FixedList< Foam::direction, 8 > searchOrder ( const point pt) const
inline

Return optimal search order to look for nearest to point.

Definition at line 310 of file treeBoundBoxI.H.

◆ subOverlaps() [1/2]

bool subOverlaps ( const direction  octant,
const boundBox bb 
) const

Does sub-octant overlap/touch boundingBox?

Definition at line 211 of file treeBoundBox.C.

References boundBox::max(), Foam::max(), boundBox::min(), and Foam::min().

Referenced by dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::findNearest(), and indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findNearest().

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

◆ subOverlaps() [2/2]

bool subOverlaps ( const direction  octant,
const point centre,
const scalar  radiusSqr 
) const
inline

Does sub-octant overlap boundingSphere (centre + sqr(radius))?

Definition at line 319 of file treeBoundBoxI.H.

◆ intersects() [1/5]

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

Intersects segment; set point to intersection position and face,.

return true if intersection found. (pt argument used during calculation even if not intersecting). Calculates intersections from outside supplied vector (overallStart, overallVec). This is so when e.g. tracking through lots of consecutive boxes (typical octree) we're not accumulating truncation errors. Set to start, (end-start) if not used.

Definition at line 255 of file treeBoundBox.C.

References stdFoam::end(), Foam::mag(), Foam::max(), Foam::min(), and s.

Referenced by indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findLine(), triangleFuncs::intersectBb(), searchableRotatedBox::overlaps(), treeDataPrimitivePatch< PatchType >::overlaps(), treeDataFace::overlaps(), treeDataEdge::overlaps(), and streamLineBase::trimToBox().

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

◆ intersects() [2/5]

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

Like above but does not return faces point is on.

Definition at line 402 of file treeBoundBox.C.

References stdFoam::end().

Here is the call graph for this function:

◆ intersects() [3/5]

bool intersects ( const linePointRef ln,
point pt 
) const
inline

Like above but does not return faces point is on.

Definition at line 340 of file treeBoundBoxI.H.

References Foam::ln().

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

Code position of point on bounding box faces.

Definition at line 451 of file treeBoundBox.C.

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

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

Position of point relative to bounding box.

Definition at line 486 of file treeBoundBox.C.

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

Referenced by treeDataPrimitivePatch< PatchType >::findIntersection(), indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findLine(), treeDataCell::findIntersectOp::operator()(), and treeDataFace::findIntersectOp::operator()().

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

◆ calcExtremities()

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

Calculate nearest and furthest (to point) vertex coords of.

bounding box

Definition at line 522 of file treeBoundBox.C.

References Foam::mag(), Foam::max(), Foam::min(), and Foam::expressions::Detail::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

Returns distance point to furthest away corner.

Definition at line 548 of file treeBoundBox.C.

◆ distanceCmp()

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

Compare distance to point with other bounding box.

return: -1 : all vertices of my bounding box are nearer than any of other +1 : all vertices of my bounding box are further away than any of other 0 : none of the above.

Definition at line 558 of file treeBoundBox.C.

References treeBoundBox::calcExtremities().

Here is the call graph for this function:

◆ extend() [1/2]

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

Return slightly wider bounding box.

Extends all dimensions with s*span*Random::sample01<scalar>() and guarantees in any direction s*mag(span) minimum width

Definition at line 350 of file treeBoundBoxI.H.

References boundBox::inflate(), and rndGen.

Here is the call graph for this function:

◆ extend() [2/2]

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

As per two parameter version but with additional grow() by given amount in each dimension.

Definition at line 364 of file treeBoundBoxI.H.

References delta, boundBox::inflate(), and rndGen.

Here is the call graph for this function:

◆ typDim()

scalar typDim ( ) const
inline

Typical dimension length,height,width. Identical to avgDim()

Definition at line 548 of file treeBoundBox.H.

References boundBox::avgDim().

Here is the call graph for this function:

◆ overlaps() [1/2]

◆ overlaps() [2/2]

bool overlaps
inline

Overlaps with other bounding box, sphere etc?

Definition at line 446 of file boundBoxI.H.

◆ intersects() [4/5]

bool intersects

intersects other bounding box, sphere etc?

Definition at line 193 of file boundBox.C.

◆ intersects() [5/5]

bool intersects

intersects other bounding box, sphere etc?

Definition at line 227 of file boundBox.C.

◆ contains() [2/6]

bool contains
inline

Contains point or other bounding box?

Definition at line 455 of file boundBoxI.H.

◆ contains() [3/6]

bool contains
inline

Contains point or other bounding box?

Definition at line 466 of file boundBoxI.H.

◆ contains() [4/6]

bool contains

Contains point or other bounding box?

Definition at line 366 of file boundBox.C.

◆ contains() [5/6]

bool contains ( unsigned  N)
inline

Contains point or other bounding box?

Definition at line 113 of file boundBoxTemplates.C.

◆ contains() [6/6]

bool contains ( class IntContainer  )
inline

Contains point or other bounding box?

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

Face to point addressing, using octant corner points.

Definition at line 174 of file treeBoundBox.H.

Referenced by searchableBox::boundingSpheres(), searchableBox::coordinates(), searchableRotatedBox::overlaps(), and OBJstream::write().

◆ edges

const Foam::edgeList edges
static

Edge to point addressing, using octant corner points.

Definition at line 179 of file treeBoundBox.H.

Referenced by triangleFuncs::intersectBb(), searchableRotatedBox::overlaps(), and OBJstream::write().


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