A bounding box defined in terms of min/max extrema points. More...
Public Types | |
enum | directionBit : direction { XDIR = 0x1 , YDIR = 0x2 , ZDIR = 0x4 } |
Bits used for (x/y/z) direction encoding. More... | |
Public Member Functions | |
boundBox () | |
Construct without any points - an inverted bounding box. More... | |
boundBox (const point &pt) | |
Construct a bounding box containing a single initial point. More... | |
boundBox (const point &min, const point &max) | |
Construct from components. 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 | valid () const |
Bounding box is non-inverted. More... | |
const point & | min () const |
Minimum describing the bounding box. More... | |
const point & | max () const |
Maximum describing the bounding box. More... | |
point & | min () |
Minimum describing the bounding box, non-const access. More... | |
point & | max () |
Maximum describing the bounding box, non-const access. More... | |
point | centre () const |
The centre (midpoint) of the bounding box. More... | |
point | midpoint () const |
The midpoint (centre) of the bounding box. Identical to centre() More... | |
vector | span () const |
The bounding box span (from minimum to maximum) More... | |
scalar | mag () const |
The magnitude of the bounding box span. 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... | |
label | nDim () const |
Count the number of positive, non-zero dimensions. More... | |
tmp< pointField > | points () const |
Corner points in an order corresponding to a 'hex' cell. More... | |
tmp< pointField > | faceCentres () const |
Face midpoints. More... | |
point | faceCentre (const direction facei) const |
Face centre of given face index. More... | |
void | clear () |
Clear bounding box and make it 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 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 | inflate (const scalar s) |
Inflate box by factor*mag(span) in all dimensions. More... | |
void | reduce () |
Parallel reduction of min/max values. More... | |
bool | intersect (const boundBox &bb) |
Intersection (union) with the second box. More... | |
bool | intersects (const plane &pln) const |
Does plane intersect this bounding box. More... | |
bool | overlaps (const boundBox &bb) const |
Overlaps/touches boundingBox? More... | |
bool | overlaps (const point ¢re, 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 &pt) const |
Return the nearest point on the boundBox to the supplied point. More... | |
void | operator+= (const boundBox &bb) |
Extend box to include the second box, as per the add() method. 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 faceList | faces |
Faces to point addressing, as per a 'hex' cell. More... | |
static const FixedList< vector, 6 > | faceNormals |
The unit normal per face. More... | |
Friends | |
Istream & | operator>> (Istream &is, boundBox &bb) |
Ostream & | operator<< (Ostream &os, const boundBox &bb) |
A bounding box defined in terms of min/max extrema points.
Definition at line 63 of file boundBox.H.
enum directionBit : direction |
Bits used for (x/y/z) direction encoding.
Enumerator | |
---|---|
XDIR | 1: x-direction (vector component 0) |
YDIR | 2: y-direction (vector component 1) |
ZDIR | 4: z-direction (vector component 2) |
Definition at line 75 of file boundBox.H.
|
inline |
Construct without any points - an inverted bounding box.
Definition at line 33 of file boundBoxI.H.
References Foam::min().
Construct a bounding box containing a single initial point.
Definition at line 40 of file boundBoxI.H.
Construct from components.
Definition at line 47 of file boundBoxI.H.
Construct as the bounding box of the given points.
Does parallel communication (doReduce = true)
Definition at line 72 of file boundBox.C.
References boundBox::add(), boundBox::points(), and boundBox::reduce().
|
explicit |
Construct as the bounding box of the given temporary pointField.
Does parallel communication (doReduce = true)
Definition at line 85 of file boundBox.C.
References boundBox::add(), and boundBox::reduce().
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 98 of file boundBox.C.
References boundBox::add(), boundBox::points(), and boundBox::reduce().
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 35 of file boundBoxTemplates.C.
References boundBox::add(), boundBox::points(), and boundBox::reduce().
Construct from Istream.
Definition at line 54 of file boundBoxI.H.
References Foam::operator>>().
|
inline |
Bounding box is inverted, contains no points.
Definition at line 62 of file boundBoxI.H.
References pTraits< bool >::nComponents.
Referenced by fieldExtents::calcFieldExtents(), and cuttingSurfaceBase::cellSelection().
|
inline |
Bounding box is non-inverted.
Definition at line 76 of file boundBoxI.H.
References pTraits< bool >::nComponents.
Referenced by isoSurfaceBase::blockCells(), cuttingSurfaceBase::checkOverlap(), cuttingPlane::checkOverlap(), searchableSphere::overlaps(), and sampledPlane::sampledPlane().
|
inline |
Minimum describing the bounding box.
Definition at line 91 of file boundBoxI.H.
Referenced by PDRblock::blockMeshDict(), eddy::bounds(), fieldExtents::calcFieldExtents(), faceAreaWeightAMI2D::calculate(), inverseDistance::cellBb(), polyMesh::cellTree(), voxelMeshSearch::centre(), boundBox::contains(), AABBTree< Type >::createBoxes(), extendedEdgeMesh::edgeTree(), triSurfaceMesh::edgeTree(), extendedEdgeMesh::edgeTreesByType(), treeBoundBox::extend(), voxelMeshSearch::fill(), inverseDistance::fill(), patchProbes::findElements(), mappedPatchBase::findLocalSamples(), dynamicIndexedOctree< Type >::findNearest(), indexedOctree< Type >::findNearest(), dynamicTreeDataPoint::findNearest(), meshSearch::findNearestBoundaryFace(), boundaryMesh::getNearest(), voxelMeshSearch::index(), voxelMeshSearch::index3(), inverseDistance::index3(), waveMakerPointPatchVectorField::initialiseGeometry(), waveModel::initialiseGeometry(), inverseDistance::markBoundaries(), trackingInverseDistance::markBoundaries(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), meshToMeshMethod::maskCells(), projectVertex::operator point(), Foam::operator==(), searchableSphere::overlaps(), voxelMeshSearch::overlaps(), inverseDistance::overlaps(), extendedEdgeMesh::pointTree(), inverseDistance::position(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), indexedOctree< treeType >::print(), energySpectrum::read(), Foam::readBoxDim(), refinementFeatures::regionEdgeTrees(), searchableDisk::searchableDisk(), searchableExtrudedCircle::searchableExtrudedCircle(), searchableSphere::searchableSphere(), searchableSurfaceCollection::searchableSurfaceCollection(), treeBoundBox::subBbox(), triSurfaceSearch::tree(), triSurfaceRegionSearch::treeByRegion(), inverseDistance::update(), trackingInverseDistance::update(), sampledMeshedSurface::update(), voxelMeshSearch::voxelMeshSearch(), topoSet::writeDebug(), voxelMeshSearch::writeGrid(), and dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::writeTreeInfo().
|
inline |
Maximum describing the bounding box.
Definition at line 97 of file boundBoxI.H.
Referenced by PDRblock::blockMeshDict(), eddy::bounds(), fieldExtents::calcFieldExtents(), faceAreaWeightAMI2D::calculate(), inverseDistance::cellBb(), polyMesh::cellTree(), boundBox::contains(), extendedEdgeMesh::edgeTree(), triSurfaceMesh::edgeTree(), extendedEdgeMesh::edgeTreesByType(), treeBoundBox::extend(), voxelMeshSearch::fill(), inverseDistance::fill(), patchProbes::findElements(), mappedPatchBase::findLocalSamples(), dynamicIndexedOctree< Type >::findNearest(), indexedOctree< Type >::findNearest(), dynamicTreeDataPoint::findNearest(), meshSearch::findNearestBoundaryFace(), advancingFrontAMI::findTargetFace(), boundaryMesh::getNearest(), waveMakerPointPatchVectorField::initialiseGeometry(), waveModel::initialiseGeometry(), Kmesh::Kmesh(), inverseDistance::markBoundaries(), trackingInverseDistance::markBoundaries(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), meshToMeshMethod::maskCells(), projectVertex::operator point(), Foam::operator==(), orientedSurface::orientedSurface(), searchableSphere::overlaps(), voxelMeshSearch::overlaps(), inverseDistance::overlaps(), extendedEdgeMesh::pointTree(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), energySpectrum::read(), Foam::readBoxDim(), refinementFeatures::regionEdgeTrees(), searchableDisk::searchableDisk(), searchableExtrudedCircle::searchableExtrudedCircle(), searchableSphere::searchableSphere(), searchableSurfaceCollection::searchableSurfaceCollection(), treeBoundBox::subBbox(), triSurfaceSearch::tree(), triSurfaceRegionSearch::treeByRegion(), sampledMeshedSurface::update(), voxelMeshSearch::voxelMeshSearch(), indexedOctree< treeType >::write(), topoSet::writeDebug(), and dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::writeTreeInfo().
|
inline |
Minimum describing the bounding box, non-const access.
Definition at line 103 of file boundBoxI.H.
|
inline |
Maximum describing the bounding box, non-const access.
Definition at line 109 of file boundBoxI.H.
|
inline |
The centre (midpoint) of the bounding box.
Definition at line 115 of file boundBoxI.H.
Referenced by PDRblock::blockMeshDict(), boundBox::faceCentre(), and advancingFrontAMI::findTargetFace().
|
inline |
The midpoint (centre) of the bounding box. Identical to centre()
Definition at line 121 of file boundBoxI.H.
|
inline |
The bounding box span (from minimum to maximum)
Definition at line 127 of file boundBoxI.H.
Referenced by PDRblock::blockMeshDict(), booleanSurface::booleanSurface(), cubeRootVolDelta::calcDelta(), voxelMeshSearch::centre(), advancingFrontAMI::checkPatches(), sensitivitySurface::computeRadius(), AABBTree< Type >::createBoxes(), treeBoundBox::extend(), mappedPatchBase::findLocalSamples(), voxelMeshSearch::index(), voxelMeshSearch::index3(), inverseDistance::index3(), Kmesh::Kmesh(), projectVertex::operator point(), orientedSurface::orientedSurface(), porosityModel::porosityModel(), inverseDistance::position(), dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::print(), snappyVoxelMeshDriver::snappyVoxelMeshDriver(), inverseDistance::update(), trackingInverseDistance::update(), sampledMeshedSurface::update(), points0MotionSolver::updateMesh(), and voxelMeshSearch::writeGrid().
|
inline |
The magnitude of the bounding box span.
Definition at line 133 of file boundBoxI.H.
Referenced by nearWallFields::calcAddressing(), searchableSurfaces::checkSizes(), refinementFeatures::checkSizes(), patchProbes::findElements(), isoSurfaceCell::isoSurfaceCell(), isoSurfaceTopo::isoSurfaceTopo(), streamLineParticle::move(), wallBoundedStreamLineParticle::move(), and triSurfaceTools::writeCloseness().
|
inline |
The volume of the bound box.
Definition at line 139 of file boundBoxI.H.
References Foam::cmptProduct().
|
inline |
Smallest length/height/width dimension.
Definition at line 145 of file boundBoxI.H.
References Foam::cmptMin().
|
inline |
Largest length/height/width dimension.
Definition at line 151 of file boundBoxI.H.
References Foam::cmptMax().
|
inline |
Average length/height/width dimension.
Definition at line 157 of file boundBoxI.H.
References Foam::cmptAv().
Referenced by boundaryMesh::getNearest().
|
inline |
Count the number of positive, non-zero dimensions.
Definition at line 163 of file boundBoxI.H.
References Foam::diff(), and pTraits< bool >::nComponents.
Foam::tmp< Foam::pointField > points | ( | ) | const |
Corner points in an order corresponding to a 'hex' cell.
Definition at line 118 of file boundBox.C.
References Time::New().
Referenced by PDRblock::blockMeshDict(), boundBox::boundBox(), searchableRotatedBox::overlaps(), and faceAreaWeightAMI2D::writeNoMatch().
Foam::tmp< Foam::pointField > faceCentres | ( | ) | const |
Face midpoints.
Definition at line 136 of file boundBox.C.
References forAll, and Time::New().
Foam::point faceCentre | ( | const direction | facei | ) | const |
Face centre of given face index.
Definition at line 150 of file boundBox.C.
References Foam::abort(), boundBox::centre(), Foam::FatalError, FatalErrorInFunction, Foam::max(), Foam::min(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
inline |
Clear bounding box and make it an inverted box.
Definition at line 184 of file boundBoxI.H.
Referenced by cuttingSurfaceBase::cellSelection(), and Foam::simpleGeometricFilter().
|
inline |
Extend to include the second box.
Definition at line 191 of file boundBoxI.H.
References Foam::max(), and Foam::min().
Referenced by boundBox::boundBox(), tetPoints::bounds(), triPoints::bounds(), searchableSurfacesQueries::bounds(), PatchTools::calcBounds(), fieldExtents::calcFieldExtents(), cuttingSurfaceBase::cellSelection(), AABBTree< Type >::createBoxes(), patchProbes::findElements(), meshToMeshMethod::intersect(), meshToMeshMethod::interVol(), meshToMeshMethod::interVolAndCentroid(), porosityModel::porosityModel(), energySpectrum::read(), Foam::simpleGeometricFilter(), and triSurface::writeStats().
|
inline |
Extend to include the point.
Definition at line 198 of file boundBoxI.H.
References Foam::max(), and Foam::min().
Extend to include the points.
Definition at line 205 of file boundBoxI.H.
References Foam::add(), p, and points.
|
inline |
Extend to include the points from the temporary point field.
Definition at line 214 of file boundBoxI.H.
References Foam::add(), and tmp< T >::clear().
Extend to include the points.
Definition at line 56 of file boundBoxTemplates.C.
References Foam::add(), p, and points.
Extend to include a (subsetted) point field.
The indices could be from edge/triFace etc.
Definition at line 69 of file boundBoxTemplates.C.
References Foam::add(), points, and UList< T >::size().
Extend to include a (subsetted) point field.
IntContainer | A container with an iterator that dereferences to an label |
Definition at line 94 of file boundBoxTemplates.C.
References Foam::add(), points, and UList< T >::size().
void inflate | ( | const scalar | s | ) |
Inflate box by factor*mag(span) in all dimensions.
Definition at line 175 of file boundBox.C.
References Foam::mag(), and s().
Referenced by AABBTree< Type >::AABBTree(), box::box(), advancingFrontAMI::checkPatches(), AABBTree< Type >::createBoxes(), AMIInterpolation::createTree(), meshToMeshMethod::maskCells(), surfaceFeatures::nearestFeatEdge(), surfaceFeatures::nearestSurfEdge(), primitiveMesh::pointInCellBB(), Foam::simpleGeometricFilter(), sampledMeshedSurface::update(), and propellerInfo::updateSampleDiskCells().
void reduce | ( | ) |
Parallel reduction of min/max values.
Definition at line 184 of file boundBox.C.
References Foam::reduce().
Referenced by boundBox::boundBox(), fieldExtents::calcFieldExtents(), cuttingSurfaceBase::cellSelection(), distributedTriSurfaceMesh::distributedTriSurfaceMesh(), porosityModel::porosityModel(), and distributedTriSurfaceMesh::writeStats().
Intersection (union) with the second box.
The return value is true if the intersection is non-empty.
Definition at line 191 of file boundBox.C.
References Foam::max(), and Foam::min().
Referenced by sampledMeshedSurface::update().
Does plane intersect this bounding box.
There is an intersection if the plane segments the corner points
Definition at line 200 of file boundBox.C.
References plane::FRONT, p, points, and plane::sideOfPlane().
Referenced by cuttingPlane::checkOverlap().
Overlaps/touches boundingBox?
Definition at line 221 of file boundBoxI.H.
References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Referenced by cuttingSurfaceBase::checkOverlap(), inverseDistance::markBoundaries(), trackingInverseDistance::markBoundaries(), meshToMeshMethod::maskCells(), faceAreaWeightAMI2D::overlappingTgtFaces(), searchablePlate::overlaps(), searchableRotatedBox::overlaps(), searchableSphere::overlaps(), indexedOctree< Type >::overlaps(), and interRegionOption::setMapper().
Overlaps boundingSphere (centre + sqr(radius))?
Definition at line 232 of file boundBoxI.H.
References Foam::mag(), and pTraits< bool >::nComponents.
Contains point? (inside or on edge)
Definition at line 271 of file boundBoxI.H.
Referenced by isoSurfaceBase::blockCells(), cuttingSurfaceBase::cellSelection(), advancingFrontAMI::checkPatches(), trackingInverseDistance::markBoundaries(), primitiveMesh::pointInCellBB(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), and Foam::simpleGeometricFilter().
Fully contains other boundingBox?
Definition at line 282 of file boundBoxI.H.
References boundBox::max(), and boundBox::min().
Contains point? (inside only)
Definition at line 288 of file boundBoxI.H.
References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Contains all points? (inside or on edge)
Definition at line 230 of file boundBox.C.
References UList< T >::empty(), p, and points.
Contains all of the (subsetted) points? (inside or on edge)
Definition at line 119 of file boundBoxTemplates.C.
References points, and UList< T >::size().
Contains all of the (subsetted) points? (inside or on edge)
IntContainer | A container with an iterator that dereferences to an label |
Definition at line 148 of file boundBoxTemplates.C.
References points, and UList< T >::size().
Contains any of the points? (inside or on edge)
Definition at line 249 of file boundBox.C.
References UList< T >::empty(), p, and points.
Referenced by searchableRotatedBox::overlaps(), treeDataFace::overlaps(), treeDataPrimitivePatch< PatchType >::overlaps(), and triSurfaceTools::triangulate().
|
inline |
Contains any of the (subsetted) points? (inside or on edge)
Definition at line 177 of file boundBoxTemplates.C.
References points, and UList< T >::size().
Contains any of the (subsetted) points? (inside or on edge)
IntContainer | A container with an iterator that dereferences to an label |
Definition at line 210 of file boundBoxTemplates.C.
References points, and UList< T >::size().
Foam::point nearest | ( | const point & | pt | ) | 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 268 of file boundBox.C.
References Foam::max(), Foam::min(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
inline |
Extend box to include the second box, as per the add() method.
Definition at line 301 of file boundBoxI.H.
References Foam::add().
|
static |
A large boundBox: min/max == -/+ ROOTVGREAT.
Definition at line 83 of file boundBox.H.
|
static |
A large inverted boundBox: min/max == +/- ROOTVGREAT.
Definition at line 86 of file boundBox.H.
Referenced by searchableSurfacesQueries::bounds(), PatchTools::calcBounds(), fieldExtents::calcFieldExtents(), patchProbes::findElements(), streamLineBase::read(), energySpectrum::read(), searchableSurfaceCollection::searchableSurfaceCollection(), and triSurface::writeStats().
|
static |
Faces to point addressing, as per a 'hex' cell.
Definition at line 89 of file boundBox.H.
|
static |
The unit normal per face.
Definition at line 92 of file boundBox.H.
Referenced by searchableBox::getNormal(), and sampledMeshedSurfaceNormal::sample().