32 template<
class Po
int,
class Po
intRef>
48 template<
class Po
int,
class Po
intRef>
55 a_(points[indices[0]]),
56 b_(points[indices[1]]),
57 c_(points[indices[2]]),
58 d_(points[indices[3]])
62 template<
class Po
int,
class Po
intRef>
71 template<
class Po
int,
class Po
intRef>
78 template<
class Po
int,
class Po
intRef>
85 template<
class Po
int,
class Po
intRef>
92 template<
class Po
int,
class Po
intRef>
99 template<
class Po
int,
class Po
intRef>
127 <<
"index out of range 0 -> 3. facei = " << facei
134 template<
class Po
int,
class Po
intRef>
141 template<
class Po
int,
class Po
intRef>
148 template<
class Po
int,
class Po
intRef>
155 template<
class Po
int,
class Po
intRef>
162 template<
class Po
int,
class Po
intRef>
165 return 0.25*(a_ + b_ + c_ + d_);
169 template<
class Po
int,
class Po
intRef>
172 return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
176 template<
class Po
int,
class Po
intRef>
189 vector num = lambda*ba - mu*ca;
190 scalar denom = (c & ba);
199 return a_ + 0.5*(a + num/denom);
203 template<
class Po
int,
class Po
intRef>
216 vector num = lambda*ba - mu*ca;
217 scalar denom = (c & ba);
229 template<
class Po
int,
class Po
intRef>
236 *
pow3(
min(circumRadius(), great))
242 template<
class Po
int,
class Po
intRef>
252 template<
class Po
int,
class Po
intRef>
258 return bary[0]*a_ + bary[1]*b_ + bary[2]*c_ + bary[3]*d_;
262 template<
class Po
int,
class Po
intRef>
269 pointToBarycentric(pt, bary);
274 template<
class Po
int,
class Po
intRef>
290 e0.
x(), e1.
x(), e2.
x(),
291 e0.
y(), e1.
y(), e2.
y(),
292 e0.
z(), e1.
z(), e2.
z()
295 scalar detT =
det(t);
317 template<
class Po
int,
class Po
intRef>
331 scalar minOutsideDistance = vGreat;
335 if (((p - b_) & Sa()) >= 0)
342 if (info.
distance() < minOutsideDistance)
346 minOutsideDistance = info.
distance();
350 if (((p - a_) & Sb()) >= 0)
357 if (info.
distance() < minOutsideDistance)
361 minOutsideDistance = info.
distance();
365 if (((p - a_) & Sc()) >= 0)
372 if (info.
distance() < minOutsideDistance)
376 minOutsideDistance = info.
distance();
380 if (((p - a_) & Sd()) >= 0)
387 if (info.
distance() < minOutsideDistance)
391 minOutsideDistance = info.
distance();
399 minOutsideDistance = 0;
412 template<
class Po
int,
class Po
intRef>
434 const point& basePt = b_;
439 if (((pt - basePt) & n) > small)
447 const point& basePt = c_;
452 if (((pt - basePt) & n) > small)
460 const point& basePt = b_;
465 if (((pt - basePt) & n) > small)
473 const point& basePt = b_;
478 if (((pt - basePt) & n) > small)
490 template<
class Po
int,
class Po
intRef>
498 is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
501 is.
check(
"Istream& operator>>(Istream&, tetrahedron&)");
507 template<
class Po
int,
class Po
intRef>
516 << t.a_ << token::SPACE
517 << t.b_ << token::SPACE
518 << t.c_ << token::SPACE
Istream & readBegin(const char *funcName)
A triangle primitive used to calculate face areas and swept volumes.
barycentric barycentric01(Random &rndGen)
Generate a random barycentric coordinate within the unit tetrahedron.
scalar circumRadius() const
Return circum-radius.
tetrahedron(const Point &a, const Point &b, const Point &c, const Point &d)
Construct from points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Point circumCentre() const
Return circum-centre.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const Point & a() const
Return vertices.
Cmpt cmptSum(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensionedScalar sqrt(const dimensionedScalar &ds)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
dimensionedScalar lambda(viscosity->lookup("lambda"))
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
const dimensionedScalar c
Speed of light in a vacuum.
Point barycentricToPoint(const barycentric &bary) const
Calculate the point from the given barycentric coordinates.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Istream & readEnd(const char *funcName)
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
scalar mag() const
Return volume.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
vector Sa() const
Return face normal.
Point centre() const
Return centre (centroid)
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Point & rawPoint() const
Return point with no checking.
const dimensionedScalar mu
Atomic mass unit.
triPointRef tri(const label facei) const
Return i-th face.
dimensionedScalar pow3(const dimensionedScalar &ds)
barycentric pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
triangle< point, const point & > triPointRef
dimensioned< scalar > mag(const dimensioned< Type > &)
PointHit< point > pointHit
Point randomPoint(Random &rndGen) const
Return a random point in the tetrahedron from a.
scalar distance() const
Return distance to hit.