Go to the documentation of this file.
36 template<
class Po
int,
class Po
intRef>
52 template<
class Po
int,
class Po
intRef>
66 template<
class Po
int,
class Po
intRef>
75 template<
class Po
int,
class Po
intRef>
82 template<
class Po
int,
class Po
intRef>
89 template<
class Po
int,
class Po
intRef>
96 template<
class Po
int,
class Po
intRef>
103 template<
class Po
int,
class Po
intRef>
130 <<
"Face index (" << facei <<
") out of range 0..3\n"
136 template<
class Po
int,
class Po
intRef>
143 template<
class Po
int,
class Po
intRef>
150 template<
class Po
int,
class Po
intRef>
157 template<
class Po
int,
class Po
intRef>
164 template<
class Po
int,
class Po
intRef>
167 return 0.25*(a_ + b_ + c_ + d_);
171 template<
class Po
int,
class Po
intRef>
174 return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
178 template<
class Po
int,
class Po
intRef>
192 scalar denom = (
c & ba);
201 return a_ + 0.5*(a + num/denom);
205 template<
class Po
int,
class Po
intRef>
219 scalar denom = (
c & ba);
231 template<
class Po
int,
class Po
intRef>
238 *
pow3(
min(circumRadius(), GREAT))
244 template<
class Po
int,
class Po
intRef>
254 template<
class Po
int,
class Po
intRef>
260 return bary[0]*a_ + bary[1]*b_ + bary[2]*c_ + bary[3]*d_;
264 template<
class Po
int,
class Po
intRef>
271 pointToBarycentric(pt, bary);
276 template<
class Po
int,
class Po
intRef>
292 e0.
x(), e1.
x(), e2.
x(),
293 e0.
y(), e1.
y(), e2.
y(),
294 e0.
z(), e1.
z(), e2.
z()
297 scalar detT =
det(t);
319 template<
class Po
int,
class Po
intRef>
333 scalar minOutsideDistance = VGREAT;
337 if (((
p - b_) & Sa()) >= 0)
344 if (info.
distance() < minOutsideDistance)
348 minOutsideDistance = info.
distance();
352 if (((
p - a_) & Sb()) >= 0)
359 if (info.
distance() < minOutsideDistance)
363 minOutsideDistance = info.
distance();
367 if (((
p - a_) & Sc()) >= 0)
374 if (info.
distance() < minOutsideDistance)
378 minOutsideDistance = info.
distance();
382 if (((
p - a_) & Sd()) >= 0)
389 if (info.
distance() < minOutsideDistance)
393 minOutsideDistance = info.
distance();
401 minOutsideDistance = 0;
414 template<
class Po
int,
class Po
intRef>
436 const point& basePt = b_;
441 if (((pt - basePt) &
n) > SMALL)
449 const point& basePt = c_;
454 if (((pt - basePt) &
n) > SMALL)
462 const point& basePt = b_;
467 if (((pt - basePt) &
n) > SMALL)
475 const point& basePt = b_;
480 if (((pt - basePt) &
n) > SMALL)
490 template<
class Po
int,
class Po
intRef>
498 template<
class Po
int,
class Po
intRef>
505 template<
class Po
int,
class Po
intRef>
511 vol_ += tet.tet().
mag();
515 template<
class Po
int,
class Po
intRef>
527 template<
class Po
int,
class Po
intRef>
533 tets_[nTets_++] = tet;
537 template<
class Po
int,
class Po
intRef>
547 (
d[posI]*t[negI] -
d[negI]*t[posI])
548 / (-
d[negI]+
d[posI]);
552 template<
class Po
int,
class Po
intRef>
553 template<
class TetOp>
566 template<
class Po
int,
class Po
intRef>
567 template<
class AboveTetOp,
class BelowTetOp>
571 const tetPoints& tet,
577 FixedList<scalar, 4>
d;
581 d[i] = pln.signedDistance(tet[i]);
608 label i1 =
d.fcIndex(i0);
609 label i2 =
d.fcIndex(i1);
610 label i3 =
d.fcIndex(i2);
612 point p01(planeIntersection(
d, tet, i0, i1));
613 point p02(planeIntersection(
d, tet, i0, i2));
614 point p03(planeIntersection(
d, tet, i0, i3));
623 if (i0 == 0 || i0 == 2)
625 tetPoints t(tet[i0], p01, p02, p03);
631 FixedList<point, 6>
p
644 decomposePrism(
p, aboveOp);
648 tetPoints t(p01, p02, p03, tet[i0]);
654 FixedList<point, 6>
p
666 decomposePrism(
p, aboveOp);
693 const edge posEdge(
pos0, pos1);
695 if (posEdge == edge(0, 1))
697 point p02(planeIntersection(
d, tet, 0, 2));
698 point p03(planeIntersection(
d, tet, 0, 3));
699 point p12(planeIntersection(
d, tet, 1, 2));
700 point p13(planeIntersection(
d, tet, 1, 3));
703 FixedList<point, 6>
p
716 decomposePrism(
p, aboveOp);
719 FixedList<point, 6>
p
732 decomposePrism(
p, belowOp);
735 else if (posEdge == edge(1, 2))
737 point p01(planeIntersection(
d, tet, 0, 1));
738 point p13(planeIntersection(
d, tet, 1, 3));
739 point p02(planeIntersection(
d, tet, 0, 2));
740 point p23(planeIntersection(
d, tet, 2, 3));
743 FixedList<point, 6>
p
756 decomposePrism(
p, aboveOp);
759 FixedList<point, 6>
p
772 decomposePrism(
p, belowOp);
775 else if (posEdge == edge(2, 0))
777 point p01(planeIntersection(
d, tet, 0, 1));
778 point p03(planeIntersection(
d, tet, 0, 3));
779 point p12(planeIntersection(
d, tet, 1, 2));
780 point p23(planeIntersection(
d, tet, 2, 3));
783 FixedList<point, 6>
p
796 decomposePrism(
p, aboveOp);
799 FixedList<point, 6>
p
812 decomposePrism(
p, belowOp);
815 else if (posEdge == edge(0, 3))
817 point p01(planeIntersection(
d, tet, 0, 1));
818 point p02(planeIntersection(
d, tet, 0, 2));
819 point p13(planeIntersection(
d, tet, 1, 3));
820 point p23(planeIntersection(
d, tet, 2, 3));
823 FixedList<point, 6>
p
836 decomposePrism(
p, aboveOp);
839 FixedList<point, 6>
p
852 decomposePrism(
p, belowOp);
855 else if (posEdge == edge(1, 3))
857 point p01(planeIntersection(
d, tet, 0, 1));
858 point p12(planeIntersection(
d, tet, 1, 2));
859 point p03(planeIntersection(
d, tet, 0, 3));
860 point p23(planeIntersection(
d, tet, 2, 3));
863 FixedList<point, 6>
p
876 decomposePrism(
p, aboveOp);
879 FixedList<point, 6>
p
892 decomposePrism(
p, belowOp);
895 else if (posEdge == edge(2, 3))
897 point p02(planeIntersection(
d, tet, 0, 2));
898 point p12(planeIntersection(
d, tet, 1, 2));
899 point p03(planeIntersection(
d, tet, 0, 3));
900 point p13(planeIntersection(
d, tet, 1, 3));
903 FixedList<point, 6>
p
916 decomposePrism(
p, aboveOp);
919 FixedList<point, 6>
p
932 decomposePrism(
p, belowOp);
938 <<
"Missed edge:" << posEdge
955 label i1 =
d.fcIndex(i0);
956 label i2 =
d.fcIndex(i1);
957 label i3 =
d.fcIndex(i2);
959 point p01(planeIntersection(
d, tet, i0, i1));
960 point p02(planeIntersection(
d, tet, i0, i2));
961 point p03(planeIntersection(
d, tet, i0, i3));
965 if (i0 == 0 || i0 == 2)
967 tetPoints t(tet[i0], p01, p02, p03);
973 FixedList<point, 6>
p
986 decomposePrism(
p, belowOp);
990 tetPoints t(p01, p02, p03, tet[i0]);
996 FixedList<point, 6>
p
1009 decomposePrism(
p, belowOp);
1019 template<
class Po
int,
class Po
intRef>
1020 template<
class AboveTetOp,
class BelowTetOp>
1024 AboveTetOp& aboveOp,
1028 tetSliceWithPlane(pl,
tetPoints(a_, b_, c_, d_), aboveOp, belowOp);
1034 template<
class Po
int,
class Po
intRef>
1042 is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
1043 is.readEnd(
"tetrahedron");
1051 template<
class Po
int,
class Po
intRef>
1055 const tetrahedron<Point, PointRef>& t
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
const Cmpt & x() const
Access to the vector x component.
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
const dimensionedScalar mu
Atomic mass unit.
Describes the interaction of a face and a point. It carries the info of a successful hit and (if succ...
static constexpr const zero Zero
Global zero (0)
Point circumCentre() const
Return circum-centre.
scalar distance() const noexcept
Return distance to hit.
tetrahedron(const Point &a, const Point &b, const Point &c, const Point &d)
Construct from points.
dimensionedScalar pos0(const dimensionedScalar &ds)
barycentric barycentric01(Random &rndGen)
Generate a random barycentric coordinate within the unit tetrahedron.
const Cmpt & z() const
Access to the vector z component.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
A triangle primitive used to calculate face normals and swept volumes.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
vector Sb() const
Face area normal for side b.
const point_type & rawPoint() const noexcept
The point, no checks.
scalar circumRadius() const
Return circum-radius.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
PointHit< point > pointHit
A PointIndexHit for 3D points.
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
OBJstream os(runTime.globalPath()/outputName)
Cmpt cmptSum(const SphericalTensor< Cmpt > &st)
Return the sum of components of a SphericalTensor.
errorManip< error > abort(error &err)
barycentric pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
const Point & a() const
Return vertices.
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
triPointRef tri(const label facei) const
Return i-th face.
vector Sa() const
Face area normal for side a.
Point randomPoint(Random &rndGen) const
Return a random point in the tetrahedron from a.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Point centre() const
Return centre (centroid)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
vector Sd() const
Face area normal for side d.
const dimensionedScalar c
Speed of light in a vacuum.
pointHit nearestPoint(const point &p) const
Return nearest point to p on triangle.
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
storeOp(tetIntersectionList &, label &)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
vector areaNormal() const
The area normal - with magnitude equal to area of triangle.
vector point
Point is a vector.
Begin list [isseparator].
vector Sc() const
Face area normal for side c.
scalar mag() const
Return volume.
void sliceWithPlane(const plane &pl, AboveTetOp &aboveOp, BelowTetOp &belowOp) const
Decompose tet into tets above and below plane.
Point barycentricToPoint(const barycentric &bary) const
Calculate the point from the given barycentric coordinates.
triangle< point, const point & > triPointRef
A triangle using referred points.