boundBox Class Reference

A bounding box defined in terms of min/max extrema points. More...

Inheritance diagram for boundBox:
Collaboration diagram for boundBox:

Public Types

enum  directionBit : direction { XDIR = 1, YDIR = 2, ZDIR = 4 }
 Bits used for (x/y/z) directional encoding. More...
 

Public Member Functions

 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 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 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...
 

Static Protected Member Functions

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...
 

Friends

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

Detailed Description

A bounding box defined in terms of min/max extrema points.

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::treeBoundBox

Definition at line 63 of file boundBox.H.

Member Enumeration Documentation

◆ directionBit

Bits used for (x/y/z) directional encoding.

Enumerator
XDIR 

1: x-direction. Same as (1 << vector::X)

YDIR 

2: y-direction. Same as (1 << vector::Y)

ZDIR 

4: z-direction. Same as (1 << vector::Z)

Definition at line 109 of file boundBox.H.

Constructor & Destructor Documentation

◆ boundBox() [1/12]

boundBox ( )
inline

Default construct: an inverted bounding box.

Definition at line 101 of file boundBoxI.H.

◆ boundBox() [2/12]

boundBox ( const boundBox )
default

Copy construct.

◆ boundBox() [3/12]

boundBox ( const boundBox bb,
bool  doReduce 
)

Copy construct with specified global reduction.

Definition at line 65 of file boundBox.C.

References boundBox::reduce().

Here is the call graph for this function:

◆ boundBox() [4/12]

boundBox ( const point p)
inlineexplicit

Construct a bounding box containing a single initial point.

Definition at line 115 of file boundBoxI.H.

◆ boundBox() [5/12]

boundBox ( const Foam::zero_one  )
inlineexplicit

Construct a 0/1 unit bounding box.

Definition at line 108 of file boundBoxI.H.

◆ boundBox() [6/12]

boundBox ( const point min,
const point max 
)
inline

Construct from bound box min/max points.

Definition at line 122 of file boundBoxI.H.

◆ boundBox() [7/12]

boundBox ( const Pair< point > &  bb)
inlineexplicit

Construct from bound box min/max points.

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

Definition at line 129 of file boundBoxI.H.

◆ boundBox() [8/12]

boundBox ( const UList< point > &  points,
bool  doReduce = true 
)
explicit

Construct as the bounding box of the given points.

Does parallel communication (doReduce = true)

Definition at line 76 of file boundBox.C.

References boundBox::add(), boundBox::points(), and boundBox::reduce().

Here is the call graph for this function:

◆ boundBox() [9/12]

boundBox ( const tmp< pointField > &  tpoints,
bool  doReduce = true 
)
explicit

Construct as the bounding box of the given temporary pointField.

Does parallel communication (doReduce = true)

Definition at line 89 of file boundBox.C.

References boundBox::add(), and boundBox::reduce().

Here is the call graph for this function:

◆ boundBox() [10/12]

boundBox ( const UList< point > &  points,
const labelUList indices,
bool  doReduce = true 
)

Construct bounding box as an indirect subset of the points.

The indices could be from cell/face etc. Does parallel communication (doReduce = true)

Definition at line 103 of file boundBox.C.

References Foam::add(), points, and Foam::reduce().

Here is the call graph for this function:

◆ boundBox() [11/12]

boundBox ( const UList< point > &  points,
const FixedList< label, N > &  indices,
bool  doReduce = true 
)

Construct bounding box as an indirect subset of the points.

The indices could be from edge/triFace etc. Does parallel communication (doReduce = true)

Definition at line 29 of file boundBoxTemplates.C.

References Foam::add(), points, and Foam::reduce().

Here is the call graph for this function:

◆ boundBox() [12/12]

boundBox ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 136 of file boundBoxI.H.

References Foam::operator>>().

Here is the call graph for this function:

Member Function Documentation

◆ box_box_overlaps()

bool box_box_overlaps ( const point minA,
const point maxA,
const point minB,
const point maxB 
)
inlinestaticprotected

Test for overlap of box and box (inclusive check)

Definition at line 388 of file boundBoxI.H.

◆ box_sphere_overlaps()

bool box_sphere_overlaps ( const point corner0,
const point corner1,
const point centre,
const scalar  radiusSqr 
)
inlinestaticprotected

Test for overlap of box and boundingSphere (centre + sqr(radius))

Note: ordering of corners is irrelevant

Definition at line 403 of file boundBoxI.H.

References Foam::magSqr(), Foam::min(), and Foam::expressions::Detail::nComponents().

Here is the call graph for this function:

◆ null()

static const boundBox& null ( )
inlinestaticnoexcept

The null boundBox is the same as an inverted box.

Definition at line 137 of file boundBox.H.

References boundBox::invertedBox.

◆ hexFaces()

const Foam::faceList & hexFaces ( )
static

The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces()

Definition at line 57 of file boundBox.C.

References hexCell::modelFaces().

Here is the call graph for this function:

◆ nPoints()

static constexpr label nPoints ( )
inlinestaticnoexcept

Number of points for boundBox and HEX.

Definition at line 151 of file boundBox.H.

Referenced by boundBox::hexCorners().

Here is the caller graph for this function:

◆ nEdges()

static constexpr label nEdges ( )
inlinestaticnoexcept

Number of edges for boundBox and HEX.

Definition at line 156 of file boundBox.H.

◆ nFaces()

static constexpr label nFaces ( )
inlinestaticnoexcept

Number of faces for boundBox and HEX.

Definition at line 161 of file boundBox.H.

Referenced by boundBox::faceCentres().

Here is the caller graph for this function:

◆ operator=()

boundBox& operator= ( const boundBox )
default

Copy assignment.

◆ empty()

bool empty ( ) const
inline

Bounding box is inverted, contains no points.

Definition at line 144 of file boundBoxI.H.

Referenced by fieldExtents::calcFieldExtents(), and cuttingSurfaceBase::cellSelection().

Here is the caller graph for this function:

◆ good()

bool good ( ) const
inline

Bounding box is non-inverted.

Definition at line 156 of file boundBoxI.H.

Referenced by isoSurfaceBase::blockCells(), cuttingPlane::checkOverlap(), cuttingSurfaceBase::checkOverlap(), boundBox::intersect(), searchableSphere::overlaps(), searchableBox::searchableBox(), and boundBox::valid().

Here is the caller graph for this function:

◆ valid()

bool valid ( ) const
inline

Bounding box is non-inverted - same as good().

Definition at line 276 of file boundBox.H.

References boundBox::good().

Here is the call graph for this function:

◆ min() [1/2]

◆ max() [1/2]

◆ min() [2/2]

Foam::point & min ( )
inlinenoexcept

Minimum describing the bounding box, non-const access.

Definition at line 174 of file boundBoxI.H.

◆ max() [2/2]

Foam::point & max ( )
inlinenoexcept

Maximum describing the bounding box, non-const access.

Definition at line 180 of file boundBoxI.H.

◆ centre()

Foam::point centre ( ) const
inline

The centre (midpoint) of the bounding box.

Definition at line 186 of file boundBoxI.H.

Referenced by PDRblock::blockMeshDict(), boundBox::faceCentre(), advancingFrontAMI::findTargetFace(), and boundBox::midpoint().

Here is the caller graph for this function:

◆ span()

◆ mag()

Foam::scalar mag ( ) const
inline

The magnitude/length of the bounding box diagonal.

Definition at line 198 of file boundBoxI.H.

Referenced by nearWallFields::calcAddressing(), refinementFeatures::checkSizes(), searchableSurfaces::checkSizes(), isoSurfaceCell::isoSurfaceCell(), isoSurfaceTopo::isoSurfaceTopo(), streamLineParticle::move(), and triSurfaceTools::writeCloseness().

Here is the caller graph for this function:

◆ magSqr()

Foam::scalar magSqr ( ) const
inline

The magnitude/length squared of bounding box diagonal.

Definition at line 204 of file boundBoxI.H.

Referenced by advancingFrontAMI::findTargetFace(), and projectVertex::operator point().

Here is the caller graph for this function:

◆ volume()

Foam::scalar volume ( ) const
inline

The volume of the bound box.

Definition at line 210 of file boundBoxI.H.

References Foam::cmptProduct().

Here is the call graph for this function:

◆ minDim()

Foam::scalar minDim ( ) const
inline

Smallest length/height/width dimension.

Definition at line 216 of file boundBoxI.H.

References Foam::cmptMin().

Here is the call graph for this function:

◆ maxDim()

Foam::scalar maxDim ( ) const
inline

Largest length/height/width dimension.

Definition at line 222 of file boundBoxI.H.

References Foam::cmptMax().

Here is the call graph for this function:

◆ avgDim()

Foam::scalar avgDim ( ) const
inline

Average length/height/width dimension.

Definition at line 228 of file boundBoxI.H.

References Foam::cmptAv().

Referenced by boundaryMesh::getNearest(), and treeBoundBox::typDim().

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

◆ minDir()

Foam::direction minDir ( ) const
inline

Direction (X/Y/Z) of the smallest span (for empty box: 0)

Definition at line 234 of file boundBoxI.H.

References Foam::expressions::Detail::nComponents().

Here is the call graph for this function:

◆ maxDir()

Foam::direction maxDir ( ) const
inline

Direction (X/Y/Z) of the largest span (for empty box: 0)

Definition at line 254 of file boundBoxI.H.

References Foam::expressions::Detail::nComponents().

Referenced by AABBTree< Type >::createBoxes().

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

◆ nDim()

int nDim ( ) const
inline

Count the number of positive, non-zero dimensions.

Returns
  • -1 : if any dimensions are negative
  • 0 : 0D (point)
  • 1 : 1D (line aligned with an axis)
  • 2 : 2D (plane aligned with an axis)
  • 3 : 3D (box)

Definition at line 274 of file boundBoxI.H.

References Foam::expressions::Detail::nComponents().

Here is the call graph for this function:

◆ hexCorner() [1/10]

point hexCorner ( ) const
inline

Return corner point [0..7] corresponding to a 'hex' cell.

Referenced by boundBox::intersects().

Here is the caller graph for this function:

◆ hexCorners()

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

Corner points in an order corresponding to a 'hex' cell.

Definition at line 122 of file boundBox.C.

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

Referenced by boundBox::points().

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

◆ points()

tmp<pointField> points ( ) const
inline

Corner points in an order corresponding to a 'hex' cell.

Definition at line 374 of file boundBox.H.

References boundBox::hexCorners().

Referenced by PDRblock::blockMeshDict(), boundBox::boundBox(), searchableRotatedBox::overlaps(), and faceAreaWeightAMI2D::writeNoMatch().

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

◆ faceCentres()

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

Face midpoints.

Definition at line 140 of file boundBox.C.

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

Here is the call graph for this function:

◆ faceCentre()

Foam::point faceCentre ( const direction  facei) const

Face centre of given face index.

Definition at line 154 of file boundBox.C.

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

Here is the call graph for this function:

◆ reset() [1/4]

void reset ( )
inline

Reset to an inverted box.

Definition at line 295 of file boundBoxI.H.

Referenced by PatchTools::calcBounds(), fieldExtents::calcFieldExtents(), and boundBox::clear().

Here is the caller graph for this function:

◆ reset() [2/4]

void reset ( const Foam::zero_one  )
inline

Reset to a 0/1 unit bounding box.

Definition at line 302 of file boundBoxI.H.

◆ reset() [3/4]

void reset ( const point pt)
inline

Reset min/max to be identical to the specified point.

Definition at line 309 of file boundBoxI.H.

◆ reset() [4/4]

void reset ( const point min,
const point max 
)
inline

Reset min/max to specified values.

Definition at line 316 of file boundBoxI.H.

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

Here is the call graph for this function:

◆ clear()

void clear ( )
inline

Same as reset() - reset to an inverted box.

Definition at line 412 of file boundBox.H.

References boundBox::reset().

Referenced by cuttingSurfaceBase::cellSelection().

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

◆ add() [1/9]

◆ add() [2/9]

void add ( const point pt)
inline

Extend to include the point.

Definition at line 330 of file boundBoxI.H.

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

Here is the call graph for this function:

◆ add() [3/9]

void add ( const point pt0,
const point pt1 
)
inline

Extend to include two additional points.

Definition at line 337 of file boundBoxI.H.

References Foam::add().

Here is the call graph for this function:

◆ add() [4/9]

void add ( const Pair< point > &  points)
inline

Extend to include two additional points.

Definition at line 344 of file boundBoxI.H.

References Foam::add(), UList< T >::first(), and points.

Here is the call graph for this function:

◆ add() [5/9]

void add ( const UList< point > &  points)
inline

Extend to include the points.

Definition at line 351 of file boundBoxI.H.

References Foam::add(), p, and points.

Here is the call graph for this function:

◆ add() [6/9]

void add ( const tmp< pointField > &  tpoints)
inline

Extend to include the points from the temporary point field.

Definition at line 360 of file boundBoxI.H.

References Foam::add(), and tmp< T >::clear().

Here is the call graph for this function:

◆ add() [7/9]

void add ( const FixedList< point, N > &  points)

Extend to include the points.

Definition at line 50 of file boundBoxTemplates.C.

References Foam::add(), p, and points.

Here is the call graph for this function:

◆ add() [8/9]

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

Extend to include a (subsetted) point field.

The indices could be from edge/triFace etc.

Definition at line 63 of file boundBoxTemplates.C.

References Foam::add(), and points.

Here is the call graph for this function:

◆ add() [9/9]

void add ( const UList< point > &  points,
const IntContainer &  indices 
)

Extend to include a (subsetted) point field.

Template Parameters
IntContainerA container with an iterator that dereferences to an label

Definition at line 88 of file boundBoxTemplates.C.

References Foam::add(), and points.

Here is the call graph for this function:

◆ grow() [1/2]

◆ grow() [2/2]

void grow ( const vector delta)
inline

Expand box by adjusting min/max by specified amounts.

Definition at line 374 of file boundBoxI.H.

References delta.

◆ inflate() [1/3]

◆ inflate() [2/3]

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.

Definition at line 416 of file boundBox.C.

References Foam::cmptMultiply(), Foam::mag(), Foam::max(), Foam::expressions::Detail::nComponents(), rndGen, and Random::sample01().

Here is the call graph for this function:

◆ inflate() [3/3]

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.

Definition at line 434 of file boundBox.C.

References delta, and rndGen.

◆ reduce()

void reduce ( )

Inplace parallel reduction of min/max values.

Definition at line 178 of file boundBox.C.

References Foam::reduce().

Referenced by boundBox::boundBox(), fieldExtents::calcFieldExtents(), cuttingSurfaceBase::cellSelection(), distributedTriSurfaceMesh::distributedTriSurfaceMesh(), uniformBin::initialise(), porosityModel::porosityModel(), boundBox::returnReduce(), and distributedTriSurfaceMesh::writeStats().

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

◆ returnReduce()

Foam::boundBox returnReduce ( const boundBox bb)
static

Perform a reduction on a copy and return the result.

Definition at line 185 of file boundBox.C.

References boundBox::reduce().

Here is the call graph for this function:

◆ intersects() [1/2]

bool intersects ( const plane pln) const

Does plane intersect this bounding box.

There is an intersection if the plane segments the corner points

Note
the results are unreliable when plane coincides almost exactly with a box face

Definition at line 193 of file boundBox.C.

References doLocalCode.

Referenced by cuttingPlane::checkOverlap().

Here is the caller graph for this function:

◆ intersects() [2/2]

bool intersects ( const triPointRef tri) const

Does triangle intersect this bounding box or is contained within this bounding box.

Note
results may be unreliable when it coincides almost exactly with a box face

Definition at line 227 of file boundBox.C.

References triangle< Point, PointRef >::a(), MinMax< T >::add(), triangle< Point, PointRef >::areaNormal(), triangle< Point, PointRef >::b(), triangle< Point, PointRef >::c(), boundBox::hexCorner(), boundBox::max(), boundBox::min(), Foam::expressions::Detail::nComponents(), MinMax< T >::overlaps(), MinMax< T >::reset(), triangle< Point, PointRef >::vecA(), triangle< Point, PointRef >::vecB(), triangle< Point, PointRef >::vecC(), and Foam::Zero.

Here is the call graph for this function:

◆ overlaps() [1/2]

bool overlaps ( const boundBox bb) const
inline

◆ overlaps() [2/2]

bool overlaps ( const point centre,
const scalar  radiusSqr 
) const
inline

Overlaps boundingSphere (centre + sqr(radius))?

Definition at line 446 of file boundBoxI.H.

◆ contains() [1/5]

bool contains ( const point pt) const
inline

Contains point? (inside or on edge)

Definition at line 455 of file boundBoxI.H.

Referenced by isoSurfaceBase::blockCells(), cuttingSurfaceBase::cellSelection(), trackingInverseDistance::markBoundaries(), and primitiveMesh::pointInCellBB().

Here is the caller graph for this function:

◆ contains() [2/5]

bool contains ( const boundBox bb) const
inline

Fully contains other boundingBox?

Definition at line 466 of file boundBoxI.H.

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

Here is the call graph for this function:

◆ containsInside()

bool containsInside ( const point pt) const
inline

Contains point? (inside only)

Definition at line 472 of file boundBoxI.H.

◆ contains() [3/5]

bool contains ( const UList< point > &  points) const

Contains all points? (inside or on edge)

Definition at line 366 of file boundBox.C.

References UList< T >::empty(), p, and points.

Here is the call graph for this function:

◆ contains() [4/5]

bool contains ( const UList< point > &  points,
const FixedList< label, N > &  indices 
) const
inline

Contains all of the (subsetted) points? (inside or on edge)

Definition at line 113 of file boundBoxTemplates.C.

References points.

◆ contains() [5/5]

bool contains ( const UList< point > &  points,
const IntContainer &  indices 
) const
inline

Contains all of the (subsetted) points? (inside or on edge)

Template Parameters
IntContainerA container with an iterator that dereferences to an label

Definition at line 142 of file boundBoxTemplates.C.

References points.

◆ containsAny() [1/3]

bool containsAny ( const UList< point > &  points) const

Contains any of the points? (inside or on edge)

Definition at line 385 of file boundBox.C.

References UList< T >::empty(), p, and points.

Referenced by searchableRotatedBox::overlaps(), treeDataPrimitivePatch< PatchType >::overlaps(), treeDataFace::overlaps(), and triSurfaceTools::triangulate().

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

◆ containsAny() [2/3]

bool containsAny ( const UList< point > &  points,
const FixedList< label, N > &  indices 
) const
inline

Contains any of the (subsetted) points? (inside or on edge)

Definition at line 171 of file boundBoxTemplates.C.

References points.

◆ containsAny() [3/3]

bool containsAny ( const UList< point > &  points,
const IntContainer &  indices 
) const
inline

Contains any of the (subsetted) points? (inside or on edge)

Template Parameters
IntContainerA container with an iterator that dereferences to an label

Definition at line 204 of file boundBoxTemplates.C.

References points.

◆ nearest()

Foam::point nearest ( const point p) const

Return the nearest point on the boundBox to the supplied point.

If point is inside the boundBox then the point is returned unchanged.

Definition at line 404 of file boundBox.C.

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

Here is the call graph for this function:

◆ operator &=()

void operator&= ( const boundBox bb)

Restrict min/max to union with other box.

◆ operator+=()

void operator+= ( const boundBox bb)
inline

Extend box to include the second box, as per the add() method.

Can be used in a reduction operation.

Definition at line 650 of file boundBox.H.

References boundBox::add().

Here is the call graph for this function:

◆ intersect()

bool intersect ( const boundBox bb)
inline

Deprecated(2022-10) - use 'operator&=' to avoid confusion with other intersects() methods.

Deprecated:
(2022-10) - use 'operator&='

Definition at line 668 of file boundBox.H.

References boundBox::good().

Here is the call graph for this function:

◆ midpoint()

point midpoint ( ) const
inline

Identical to centre()

Definition at line 673 of file boundBox.H.

References boundBox::centre().

Here is the call graph for this function:

◆ hexCorner() [2/10]

Foam::point hexCorner ( ) const
inline

Definition at line 32 of file boundBoxI.H.

◆ hexCorner() [3/10]

Foam::point hexCorner ( ) const
inline

Definition at line 39 of file boundBoxI.H.

◆ hexCorner() [4/10]

Foam::point hexCorner ( ) const
inline

Definition at line 46 of file boundBoxI.H.

◆ hexCorner() [5/10]

Foam::point hexCorner ( ) const
inline

Definition at line 53 of file boundBoxI.H.

◆ hexCorner() [6/10]

Foam::point hexCorner ( ) const
inline

Definition at line 60 of file boundBoxI.H.

◆ hexCorner() [7/10]

Foam::point hexCorner ( ) const
inline

Definition at line 67 of file boundBoxI.H.

◆ hexCorner() [8/10]

Foam::point hexCorner ( ) const
inline

Definition at line 74 of file boundBoxI.H.

◆ hexCorner() [9/10]

Foam::point hexCorner ( ) const
inline

Definition at line 81 of file boundBoxI.H.

◆ hexCorner() [10/10]

Foam::point hexCorner ( ) const
inline

Definition at line 92 of file boundBoxI.H.

Friends And Related Function Documentation

◆ operator>>

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

◆ operator<<

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

Member Data Documentation

◆ greatBox

const Foam::boundBox greatBox
static

A large boundBox: min/max == -/+ ROOTVGREAT.

Definition at line 119 of file boundBox.H.

◆ invertedBox

const Foam::boundBox invertedBox
static

A large inverted boundBox: min/max == +/- ROOTVGREAT.

Definition at line 124 of file boundBox.H.

Referenced by boundBox::null(), and treeBoundBox::null().

◆ faceNormals

const Foam::FixedList< Foam::vector, 6 > faceNormals
static

The unit normal per face.

Definition at line 129 of file boundBox.H.

Referenced by searchableBox::getNormal().


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