41 point::uniform(-ROOTVGREAT),
42 point::uniform(ROOTVGREAT)
47 point::uniform(ROOTVGREAT),
48 point::uniform(-ROOTVGREAT)
111 const UList<point>&
points,
132 auto&
pts = tpts.ref();
134 pts[0] = hexCorner<0>();
135 pts[1] = hexCorner<1>();
136 pts[2] = hexCorner<2>();
137 pts[3] = hexCorner<3>();
138 pts[4] = hexCorner<4>();
139 pts[5] = hexCorner<5>();
141 pts[7] = hexCorner<7>();
150 auto&
pts = tpts.ref();
154 pts[facei] = faceCentre(facei);
167 case 0: pt.x() =
min().x();
break;
168 case 1: pt.x() =
max().x();
break;
169 case 2: pt.y() =
min().y();
break;
170 case 3: pt.y() =
max().y();
break;
171 case 4: pt.z() =
min().z();
break;
172 case 5: pt.z() =
max().z();
break;
176 <<
"Face:" << int(facei) <<
" should be [0..5]" 212 #define doLocalCode(Idx) \ 214 side |= (pln.whichSide(hexCorner<Idx>()) == plane::BACK ? 1 : 2); \ 215 if (side == 3) return true; \ 243 if (contains(tri.
a()) || contains(tri.
b()) || contains(tri.
c()))
250 const auto project_box = []
257 extent.reset(axis & bb.hexCorner<0>());
258 extent.add(axis & bb.hexCorner<1>());
259 extent.add(axis & bb.hexCorner<2>());
260 extent.add(axis & bb.hexCorner<3>());
261 extent.add(axis & bb.hexCorner<4>());
262 extent.add(axis & bb.hexCorner<5>());
263 extent.add(axis & bb.hexCorner<6>());
264 extent.add(axis & bb.hexCorner<7>());
273 const boundBox& bb = *
this;
285 tri_extent.reset(tri.
a().x());
286 tri_extent.add(tri.
b().x());
287 tri_extent.add(tri.
c().x());
289 box_extent.reset(bb.min().x(), bb.max().x());
291 if (!tri_extent.overlaps(box_extent))
297 tri_extent.reset(tri.
a().y());
298 tri_extent.add(tri.
b().y());
299 tri_extent.add(tri.
c().y());
301 box_extent.reset(bb.min().y(), bb.max().y());
303 if (!tri_extent.overlaps(box_extent))
309 tri_extent.reset(tri.
a().z());
310 tri_extent.add(tri.
b().z());
311 tri_extent.add(tri.
c().z());
313 box_extent.reset(bb.min().z(), bb.max().z());
315 if (!tri_extent.overlaps(box_extent))
333 tri_extent.reset(axis & tri.
a());
334 project_box(bb, axis, box_extent);
336 if (!tri_extent.overlaps(box_extent))
353 axis = (edgeVec ^ axis);
356 tri_extent.reset(axis & tri.
a());
357 tri_extent.add(axis & tri.
b());
358 tri_extent.add(axis & tri.
c());
360 project_box(bb, axis, box_extent);
362 if (!tri_extent.overlaps(box_extent))
428 const scalar minSpan = factor *
Foam::mag(newSpan);
432 newSpan[dir] =
Foam::max(newSpan[dir], minSpan);
469 reinterpret_cast<const char*>(&bb.min_),
487 Detail::readContiguous<boundBox>
490 reinterpret_cast<char*
>(&bb.min_),
496 is >> bb.min_ >> bb.max_;
boundBox()
Default construct: an inverted bounding box.
A triangle primitive used to calculate face normals and swept volumes. Uses referred points...
Inter-processor communication reduction functions.
MinMax< scalar > scalarMinMax
A scalar min/max range.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual Ostream & write(const char c) override
Write character.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
bool contains(const point &pt) const
Contains point? (inside or on edge)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
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.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
bool empty() const noexcept
True if List is empty (ie, size() is zero)
const Point & a() const noexcept
The first vertex.
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.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
static const boundBox greatBox
A large boundBox: min/max == -/+ ROOTVGREAT.
static const Foam::faceList & modelFaces()
Return the model faces.
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.
const Point & c() const noexcept
The third vertex.
Point vecB() const
Edge vector opposite point b(): from c() to a()
static constexpr label nPoints() noexcept
Number of points for boundBox and HEX.
UList< label > labelUList
A UList of labels.
void operator &=(const boundBox &bb)
Restrict min/max to union with other 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.
Type sample01()
Return a sample whose components lie in the range [0,1].
point nearest(const point &p) const
Return the nearest point on the boundBox to the supplied point.
const Point & b() const noexcept
The second vertex.
static vector areaNormal(const Point &p0, const Point &p1, const Point &p2)
The area normal for a triangle defined by three points (right-hand rule). Magnitude equal to area of ...
Point vecA() const
Edge vector opposite point a(): from b() to c()
Istream & operator>>(Istream &, directionInfo &)
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
tmp< pointField > faceCentres() const
Face midpoints.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
void reduce()
Inplace parallel reduction of min/max values.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
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)
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.
Point vecC() const
Edge vector opposite point c(): from a() to b()
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.
A class for managing temporary objects.
point centre() const
The centre (midpoint) of the bounding box.
streamFormat format() const noexcept
Get the current stream format.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
static constexpr const zero Zero
Global zero (0)