36 vector(-great, -great, -great),
37 vector(great, great, great)
43 vector(great, great, great),
44 vector(-great, -great, -great)
64 initListList<face, label, 6, 4>(facesArray)
108 edges[edgeI][0] = edgesArray[edgeI][0];
109 edges[edgeI][1] = edgesArray[edgeI][1];
117 FixedList<vector, 6> normals;
118 normals[faceId::left] =
vector(-1, 0, 0);
119 normals[faceId::right] =
vector( 1, 0, 0);
120 normals[faceId::bottom] =
vector( 0, -1, 0);
121 normals[faceId::top] =
vector( 0, 1, 0);
122 normals[faceId::back] =
vector( 0, 0, -1);
123 normals[faceId::front] =
vector( 0, 0, 1);
137 <<
"cannot find bounding box for zero-sized pointField, "
138 <<
"returning zero" <<
endl;
156 <<
"cannot find bounding box for zero-sized pointField, "
157 <<
"returning zero" <<
endl;
173 points[octant] = corner(octant);
182 return subBbox(midpoint(), octant);
195 <<
"octant should be [0..7]"
204 if (octant & octantBit::rightHalf)
213 if (octant & octantBit::topHalf)
222 if (octant & octantBit::frontHalf)
237 const point& overallStart,
265 for (
label i = 0; i < 4; ++i)
272 ptOnFaces = faceBits(pt);
276 if ((ptBits & endBits) != 0)
279 ptOnFaces = faceBits(pt);
283 if (ptBits & faceBit::left)
288 scalar
s = (
min().x() - overallStart.
x())/overallVec.
x();
290 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
291 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
300 else if (ptBits & faceBit::right)
305 scalar
s = (
max().x() - overallStart.
x())/overallVec.
x();
307 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
308 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
315 else if (ptBits & faceBit::bottom)
320 scalar
s = (
min().y() - overallStart.
y())/overallVec.
y();
321 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
323 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
330 else if (ptBits & faceBit::top)
335 scalar
s = (
max().y() - overallStart.
y())/overallVec.
y();
336 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
338 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
345 else if (ptBits & faceBit::back)
350 scalar
s = (
min().z() - overallStart.
z())/overallVec.
z();
351 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
352 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
360 else if (ptBits & faceBit::front)
365 scalar
s = (
max().z() - overallStart.
z())/overallVec.
z();
366 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
367 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
390 return intersects(start, end-start, start, end, pt, ptBits);
400 if (pt[cmpt] <
min()[cmpt])
404 else if (pt[cmpt] ==
min()[cmpt])
413 if (pt[cmpt] >
max()[cmpt])
417 else if (pt[cmpt] ==
max()[cmpt])
435 if (pt.
x() ==
min().
x())
437 faceBits |= faceBit::left;
439 else if (pt.
x() ==
max().
x())
441 faceBits |= faceBit::right;
444 if (pt.
y() ==
min().
y())
446 faceBits |= faceBit::bottom;
448 else if (pt.
y() ==
max().
y())
450 faceBits |= faceBit::top;
453 if (pt.
z() ==
min().z())
455 faceBits |= faceBit::back;
457 else if (pt.
z() ==
max().z())
459 faceBits |= faceBit::front;
469 if (pt.
x() <
min().
x())
471 posBits |= faceBit::left;
473 else if (pt.
x() >
max().
x())
475 posBits |= faceBit::right;
478 if (pt.
y() <
min().
y())
480 posBits |= faceBit::bottom;
482 else if (pt.
y() >
max().
y())
484 posBits |= faceBit::top;
487 if (pt.
z() <
min().z())
489 posBits |= faceBit::back;
491 else if (pt.
z() >
max().z())
493 posBits |= faceBit::front;
506 scalar nearX, nearY, nearZ;
507 scalar farX, farY, farZ;
542 nearest =
point(nearX, nearY, nearZ);
543 furthest =
point(farX, farY, farZ);
550 calcExtremities(pt, near, far);
566 point nearThis, farThis;
569 calcExtremities(pt, nearThis, farThis);
571 const scalar minDistThis =
572 sqr(nearThis.
x() - pt.
x())
573 +
sqr(nearThis.
y() - pt.
y())
574 +
sqr(nearThis.
z() - pt.
z());
575 const scalar maxDistThis =
576 sqr(farThis.
x() - pt.
x())
577 +
sqr(farThis.
y() - pt.
y())
578 +
sqr(farThis.
z() - pt.
z());
584 point nearOther, farOther;
589 const scalar minDistOther =
590 sqr(nearOther.
x() - pt.
x())
591 +
sqr(nearOther.
y() - pt.
y())
592 +
sqr(nearOther.
z() - pt.
z());
593 const scalar maxDistOther =
594 sqr(farOther.
x() - pt.
x())
595 +
sqr(farOther.
y() - pt.
y())
596 +
sqr(farOther.
z() - pt.
z());
601 if (maxDistThis < minDistOther)
606 else if (minDistThis > maxDistOther)
623 Info<<
"Dumping bounding box " << *
this <<
" as lines to obj file "
630 const point& pt = bbPoints[i];
632 str<<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
639 str<<
"l " <<
e[0]+1 <<
' ' <<
e[1]+1 <<
nl;
666 return os << static_cast<const boundBox&>(bb);
672 return is >>
static_cast<boundBox&
>(bb);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> with a fixed size <Size>.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const
Return true if the UList is empty (ie, size() is zero)
A bounding box defined in terms of the points at its extremities.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Standard boundBox + extra functionality for use in octree.
void writeOBJ(const fileName &fName) const
void calcExtremities(const point &pt, point &nearest, point &furthest) const
Calculate nearest and furthest (to point) vertex coords of.
scalar maxDist(const point &) const
Returns distance point to furthest away corner.
label distanceCmp(const point &, const treeBoundBox &other) const
Compare distance to point with other bounding box.
direction faceBits(const point &) const
Code position of point on bounding box faces.
treeBoundBox subBbox(const direction) const
Sub box given by octant number. Midpoint calculated.
static const scalar great
The great value used for greatBox and invertedBox.
static const edgeList edges
Edge to point addressing.
bool contains(const point &) const
Contains point or other bounding box?
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,.
static const treeBoundBox invertedBox
As per boundBox::invertedBox, but with great instead of vGreat.
static const treeBoundBox greatBox
As per boundBox::greatBox, but with great instead of vGreat.
static const FixedList< vector, 6 > faceNormals
Per face the unit normal.
static const faceList faces
Face to point addressing.
direction posBits(const point &) const
Position of point relative to bounding box.
treeBoundBox()
Construct null setting points to zero.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
bool operator!=(const particle &, const particle &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
Istream & operator>>(Istream &, directionInfo &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Ostream & operator<<(Ostream &, const ensightPart &)