32 template<
class Po
int,
class Po
intRef>
48 template<
class Po
int,
class Po
intRef>
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>
191 const scalar denom = (
c & ba);
200 const vector v = (a + num/denom)/2;
206 template<
class Po
int,
class Po
intRef>
213 if (crSqr.
second() < 0)
return crSqr;
219 template<
class Po
int,
class Po
intRef>
222 const scalar r = circumSphere().second();
227 static const scalar sqrt3 =
sqrt(scalar(3));
229 return mag()/(8.0/27.0*sqrt3*
pow3(
min(r, great)) + rootVSmall);
233 template<
class Po
int,
class Po
intRef>
243 template<
class Po
int,
class Po
intRef>
249 return bary[0]*a_ + bary[1]*b_ + bary[2]*c_ + bary[3]*d_;
253 template<
class Po
int,
class Po
intRef>
260 pointToBarycentric(pt, bary);
265 template<
class Po
int,
class Po
intRef>
281 e0.
x(), e1.
x(), e2.
x(),
282 e0.
y(), e1.
y(), e2.
y(),
283 e0.
z(), e1.
z(), e2.
z()
286 scalar detT =
det(t);
308 template<
class Po
int,
class Po
intRef>
322 scalar minOutsideDistance = vGreat;
326 if (((
p - b_) & Sa()) >= 0)
333 if (info.
distance() < minOutsideDistance)
337 minOutsideDistance = info.
distance();
341 if (((
p - a_) & Sb()) >= 0)
348 if (info.
distance() < minOutsideDistance)
352 minOutsideDistance = info.
distance();
356 if (((
p - a_) & Sc()) >= 0)
363 if (info.
distance() < minOutsideDistance)
367 minOutsideDistance = info.
distance();
371 if (((
p - a_) & Sd()) >= 0)
378 if (info.
distance() < minOutsideDistance)
382 minOutsideDistance = info.
distance();
390 minOutsideDistance = 0;
403 template<
class Po
int,
class Po
intRef>
425 const point& basePt = b_;
430 if (((pt - basePt) &
n) > small)
438 const point& basePt = c_;
443 if (((pt - basePt) &
n) > small)
451 const point& basePt = b_;
456 if (((pt - basePt) &
n) > small)
464 const point& basePt = b_;
469 if (((pt - basePt) &
n) > small)
479 template<
class Po
int,
class Po
intRef>
493 template<
class Po
int,
class Po
intRef>
501 is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
504 is.
check(
"Istream& operator>>(Istream&, tetrahedron&)");
510 template<
class Po
int,
class Po
intRef>
514 const tetrahedron<Point, PointRef>& t
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Istream & readEnd(const char *funcName)
Istream & readBegin(const char *funcName)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
scalar distance() const
Return distance to hit.
const Point & rawPoint() const
Return point with no checking.
A 2-tuple for storing two objects of different types.
const Type2 & second() const
Return second.
const Type1 & first() const
Return first.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
A bounding box defined in terms of the points at its extremities.
barycentric pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
triPointRef tri(const label facei) const
Return i-th face.
boundBox bounds() const
Calculate the bounding box.
const Point & a() const
Return vertices.
Point centre() const
Return centre (centroid)
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
Tuple2< Point, scalar > circumSphereSqr() const
Return the circum-centre and radius-squared.
Tuple2< Point, scalar > circumSphere() const
Return the circum-centre and radius.
scalar mag() const
Return volume.
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
Point randomPoint(randomGenerator &rndGen) const
Return a random point in the tetrahedron from a.
Point barycentricToPoint(const barycentric &bary) const
Calculate the point from the given barycentric coordinates.
tetrahedron(const Point &a, const Point &b, const Point &c, const Point &d)
Construct from points.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
vector Sa() const
Return face normal.
A triangle primitive used to calculate face areas and swept volumes.
vector area() const
Return vector area.
pointHit nearestPoint(const point &p) const
Return nearest point to p on triangle.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar lambda(viscosity->lookup("lambda"))
const dimensionedScalar mu
Atomic mass unit.
const dimensionedScalar c
Speed of light in a vacuum.
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
barycentric barycentric01(randomGenerator &rndGen)
Generate a random barycentric coordinate within the unit tetrahedron.
void inv(pointPatchField< tensor > &, const pointPatchField< tensor > &)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
PointHit< point > pointHit
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void det(pointPatchField< scalar > &, const pointPatchField< tensor > &)
triangle< point, const point & > triPointRef
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Cmpt cmptSum(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
randomGenerator rndGen(653213)