43 #ifndef Foam_boundBox_H 44 #define Foam_boundBox_H 60 template<
class T>
class MinMax;
62 Istream&
operator>>(Istream& is, boundBox& bb);
98 const scalar radiusSqr
216 inline bool empty()
const;
219 inline bool good()
const;
243 inline scalar
mag() const;
246 inline scalar
magSqr() const;
249 inline scalar
volume() const;
252 inline scalar
minDim() const;
255 inline scalar
maxDim() const;
258 inline scalar
avgDim() const;
273 inline
int nDim() const;
319 inline void add(
const Pair<point>&
points);
322 inline void add(
const UList<point>&
points);
325 inline void add(
const tmp<pointField>& tpoints);
329 void add(
const FixedList<point, N>&
points);
336 const UList<point>&
points,
337 const FixedList<label, N>& indices
344 template<
class IntContainer>
347 const UList<point>&
points,
348 const IntContainer& indices
359 inline void inflate(
const scalar factor);
368 void inflate(Random& r,
const scalar factor,
const scalar
delta);
401 const scalar radiusSqr
429 template<
class IntContainer>
433 const IntContainer& indices
452 template<
class IntContainer>
456 const IntContainer& indices
498 template<>
struct is_contiguous<boundBox> : is_contiguous<point> {};
501 template<>
struct is_contiguous_scalar<boundBox>
503 is_contiguous_scalar<point>
509 inline bool operator==(
const boundBox& a,
const boundBox&
b)
511 return (a.min() ==
b.min() && a.max() ==
b.max());
515 inline bool operator!=(
const boundBox& a,
const boundBox&
b)
521 inline bool operator<(
const boundBox& a,
const boundBox&
b)
526 || (!(
b.min() < a.min()) && a.max() <
b.max())
531 inline bool operator<=(
const boundBox& a,
const boundBox&
b)
537 inline bool operator>(
const boundBox& a,
const boundBox&
b)
543 inline bool operator>=(
const boundBox& a,
const boundBox&
b)
boundBox()
Default construct: an inverted bounding box.
static const boundBox & null() noexcept
The null boundBox is the same as an inverted box.
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)
A triangle primitive used to calculate face normals and swept volumes. Uses referred points...
point hexCorner() const
Return corner point [0..7] corresponding to a 'hex' cell.
A 1D vector of objects of type <T> with a fixed length <N>.
bool contains(const point &pt) const
Contains point? (inside or on edge)
static const Foam::faceList & hexFaces()
The boundBox faces as a hexCell, using hexCorner points. Same as hexCell::modelFaces() ...
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
static constexpr label nEdges() noexcept
Number of edges for boundBox and HEX.
bool empty() const
Bounding box is inverted, contains no points.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
directionBit
Bits used for (x/y/z) directional encoding.
void clear()
Same as reset() - reset to an inverted box.
int nDim() const
Count the number of positive, non-zero dimensions.
bool operator>(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A newer than B.
A bounding box defined in terms of min/max extrema points.
static boundBox returnReduce(const boundBox &bb)
Perform a reduction on a copy and return the result.
static const FixedList< vector, 6 > faceNormals
The unit normal per face.
void operator+=(const boundBox &bb)
Extend box to include the second box, as per the add() method.
static const boundBox greatBox
A large boundBox: min/max == -/+ ROOTVGREAT.
const point & min() const noexcept
Minimum describing the bounding box.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
bool intersects(const plane &pln) const
Does plane intersect this bounding box.
bool operator<(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A older than B.
static constexpr label nPoints() noexcept
Number of points for boundBox and HEX.
bool operator>=(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A same or newer than B.
scalar avgDim() const
Average length/height/width dimension.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
void operator &=(const boundBox &bb)
Restrict min/max to union with other box.
scalar magSqr() const
The magnitude/length squared of bounding box diagonal.
const point & max() const noexcept
Maximum describing the bounding box.
tmp< pointField > hexCorners() const
Corner points in an order corresponding to a 'hex' cell.
void add(const boundBox &bb)
Extend to include the second box.
bool operator<=(const IOstreamOption::versionNumber &a, const IOstreamOption::versionNumber &b) noexcept
Version A same or older than B.
friend Ostream & operator<<(Ostream &os, const boundBox &bb)
direction minDir() const
Direction (X/Y/Z) of the smallest span (for empty box: 0)
bool valid() const
Bounding box is non-inverted - same as good().
point nearest(const point &p) const
Return the nearest point on the boundBox to the supplied point.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Istream & operator>>(Istream &, directionInfo &)
scalar mag() const
The magnitude/length of the bounding box diagonal.
boundBox & operator=(const boundBox &)=default
Copy assignment.
tmp< pointField > faceCentres() const
Face midpoints.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void reduce()
Inplace parallel reduction of min/max values.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static constexpr label nFaces() noexcept
Number of faces for boundBox and HEX.
OBJstream os(runTime.globalPath()/outputName)
bool containsAny(const UList< point > &points) const
Contains any of the points? (inside or on edge)
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
point faceCentre(const direction facei) const
Face centre of given face index.
4: z-direction. Same as (1 << vector::Z)
static const boundBox invertedBox
A large inverted boundBox: min/max == +/- ROOTVGREAT.
vector point
Point is a vector.
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
bool good() const
Bounding box is non-inverted.
point midpoint() const
Identical to centre()
vector span() const
The bounding box span (from minimum to maximum)
1: x-direction. Same as (1 << vector::X)
scalar volume() const
The volume of the bound box.
void reset()
Reset to an inverted box.
direction maxDir() const
Direction (X/Y/Z) of the largest span (for empty box: 0)
bool operator!=(const eddy &a, const eddy &b)
scalar maxDim() const
Largest length/height/width dimension.
A class for managing temporary objects.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
2: y-direction. Same as (1 << vector::Y)
point centre() const
The centre (midpoint) of the bounding box.
bool intersect(const boundBox &bb)
Deprecated(2022-10) - use 'operator&=' to avoid confusion with other intersects() methods...
friend Istream & operator>>(Istream &is, boundBox &bb)
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
scalar minDim() const
Smallest length/height/width dimension.
bool containsInside(const point &pt) const
Contains point? (inside only)
static bool box_sphere_overlaps(const point &corner0, const point &corner1, const point ¢re, const scalar radiusSqr)
Test for overlap of box and boundingSphere (centre + sqr(radius))