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>
262 template<
class Po
int,
class Po
intRef>
268 return bary[0]*a_ + bary[1]*b_ + bary[2]*c_ + bary[3]*d_;
272 template<
class Po
int,
class Po
intRef>
279 pointToBarycentric(pt, bary);
284 template<
class Po
int,
class Po
intRef>
300 e0.
x(), e1.
x(), e2.
x(),
301 e0.
y(), e1.
y(), e2.
y(),
302 e0.
z(), e1.
z(), e2.
z()
305 scalar detT =
det(t);
327 template<
class Po
int,
class Po
intRef>
341 scalar minOutsideDistance = VGREAT;
345 if (((p - b_) & Sa()) >= 0)
352 if (info.
distance() < minOutsideDistance)
356 minOutsideDistance = info.
distance();
360 if (((p - a_) & Sb()) >= 0)
367 if (info.
distance() < minOutsideDistance)
371 minOutsideDistance = info.
distance();
375 if (((p - a_) & Sc()) >= 0)
382 if (info.
distance() < minOutsideDistance)
386 minOutsideDistance = info.
distance();
390 if (((p - a_) & Sd()) >= 0)
397 if (info.
distance() < minOutsideDistance)
401 minOutsideDistance = info.
distance();
409 minOutsideDistance = 0;
422 template<
class Po
int,
class Po
intRef>
444 const point& basePt = b_;
449 if (((pt - basePt) & n) > SMALL)
457 const point& basePt = c_;
462 if (((pt - basePt) & n) > SMALL)
470 const point& basePt = b_;
475 if (((pt - basePt) & n) > SMALL)
483 const point& basePt = b_;
488 if (((pt - basePt) & n) > SMALL)
500 template<
class Po
int,
class Po
intRef>
508 is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
511 is.
check(
"Istream& operator>>(Istream&, tetrahedron&)");
517 template<
class Po
int,
class Po
intRef>
526 << t.a_ << token::SPACE
527 << t.b_ << token::SPACE
528 << t.c_ << token::SPACE
Istream & readBegin(const char *funcName)
A triangle primitive used to calculate face normals and swept volumes.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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)
Foam::barycentric barycentric01(Foam::scalar s, Foam::scalar t, Foam::scalar u)
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
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)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
scalar mag() const
Return volume.
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...
Simple random number generator.
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.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
A normal distribution model.
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.
const dimensionedScalar c
Speed of light in a vacuum.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
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.