tetrahedron< Point, PointRef > Class Template Reference

A tetrahedron primitive. More...

Public Types

enum  { nVertices = 4 , nEdges = 6 }
 

Public Member Functions

 tetrahedron (const Point &a, const Point &b, const Point &c, const Point &d)
 Construct from points. More...
 
 tetrahedron (const UList< Point > &, const FixedList< label, 4 > &indices)
 Construct from four points in the list of points. More...
 
 tetrahedron (Istream &)
 Construct from Istream. More...
 
const Point & a () const
 Return vertices. More...
 
const Point & b () const
 
const Point & c () const
 
const Point & d () const
 
triPointRef tri (const label facei) const
 Return i-th face. More...
 
vector Sa () const
 Return face normal. More...
 
vector Sb () const
 
vector Sc () const
 
vector Sd () const
 
Point centre () const
 Return centre (centroid) More...
 
scalar mag () const
 Return volume. More...
 
Tuple2< Point, scalar > circumSphere () const
 Return the circum centre and radius. More...
 
scalar quality () const
 Return quality: Ratio of tetrahedron and circum-sphere. More...
 
Point randomPoint (randomGenerator &rndGen) const
 Return a random point in the tetrahedron from a. More...
 
Point barycentricToPoint (const barycentric &bary) const
 Calculate the point from the given barycentric coordinates. More...
 
barycentric pointToBarycentric (const point &pt) const
 Calculate the barycentric coordinates from the given point. More...
 
scalar pointToBarycentric (const point &pt, barycentric &bary) const
 Calculate the barycentric coordinates from the given point. More...
 
pointHit nearestPoint (const point &p) const
 Return nearest point to p on tetrahedron. Is p itself. More...
 
bool inside (const point &pt) const
 Return true if point is inside tetrahedron. More...
 
boundBox bounds () const
 Calculate the bounding box. More...
 

Friends

Istreamoperator>> (Istream &, tetrahedron &)
 
Ostreamoperator (Ostream &, const tetrahedron &)
 

Detailed Description

template<class Point, class PointRef>
class Foam::tetrahedron< Point, PointRef >

A tetrahedron primitive.

Ordering of edges needs to be the same for a tetrahedron class, a tetrahedron cell shape model and a tetCell.

Source files

Definition at line 81 of file tetrahedron.H.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
nVertices 
nEdges 

Definition at line 92 of file tetrahedron.H.

Constructor & Destructor Documentation

◆ tetrahedron() [1/3]

tetrahedron ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  d 
)
inline

Construct from points.

Definition at line 33 of file tetrahedronI.H.

◆ tetrahedron() [2/3]

tetrahedron ( const UList< Point > &  points,
const FixedList< label, 4 > &  indices 
)
inline

Construct from four points in the list of points.

Definition at line 49 of file tetrahedronI.H.

◆ tetrahedron() [3/3]

tetrahedron ( Istream is)
inline

Construct from Istream.

Definition at line 63 of file tetrahedronI.H.

Member Function Documentation

◆ a()

const Point & a
inline

Return vertices.

Definition at line 72 of file tetrahedronI.H.

◆ b()

const Point & b
inline

Definition at line 79 of file tetrahedronI.H.

◆ c()

const Point & c
inline

Definition at line 86 of file tetrahedronI.H.

◆ d()

const Point & d
inline

Definition at line 93 of file tetrahedronI.H.

◆ tri()

Foam::triPointRef tri ( const label  facei) const
inline

Return i-th face.

Definition at line 100 of file tetrahedronI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ Sa()

Foam::vector Sa
inline

Return face normal.

Definition at line 135 of file tetrahedronI.H.

References triangle< Point, PointRef >::area().

Here is the call graph for this function:

◆ Sb()

Foam::vector Sb
inline

Definition at line 142 of file tetrahedronI.H.

References triangle< Point, PointRef >::area().

Here is the call graph for this function:

◆ Sc()

Foam::vector Sc
inline

Definition at line 149 of file tetrahedronI.H.

References triangle< Point, PointRef >::area().

Here is the call graph for this function:

◆ Sd()

Foam::vector Sd
inline

Definition at line 156 of file tetrahedronI.H.

References triangle< Point, PointRef >::area().

Here is the call graph for this function:

◆ centre()

Point centre
inline

Return centre (centroid)

Definition at line 163 of file tetrahedronI.H.

◆ mag()

Foam::scalar mag
inline

Return volume.

Definition at line 170 of file tetrahedronI.H.

Referenced by tetOverlapVolume::cellVolumeMinDecomp(), and Dual< Type >::Dual().

Here is the caller graph for this function:

◆ circumSphere()

Foam::Tuple2< Point, Foam::scalar > circumSphere
inline

Return the circum centre and radius.

Definition at line 178 of file tetrahedronI.H.

References b, Foam::constant::universal::c, lambda(), Foam::mag(), Foam::magSqr(), Foam::constant::physicoChemical::mu, Foam::sqrt(), and VectorSpace< Form, Cmpt, Ncmpts >::uniform().

Here is the call graph for this function:

◆ quality()

Foam::scalar quality
inline

Return quality: Ratio of tetrahedron and circum-sphere.

volume, scaled so that a regular tetrahedron has a quality of 1

Definition at line 208 of file tetrahedronI.H.

References Foam::mag(), Foam::min(), Foam::pow3(), and Foam::sqrt().

Referenced by polyMeshTetDecomposition::minQuality().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomPoint()

Point randomPoint ( randomGenerator rndGen) const
inline

Return a random point in the tetrahedron from a.

uniform distribution

Definition at line 217 of file tetrahedronI.H.

References Foam::barycentric01(), and rndGen().

Here is the call graph for this function:

◆ barycentricToPoint()

Point barycentricToPoint ( const barycentric bary) const
inline

Calculate the point from the given barycentric coordinates.

Definition at line 227 of file tetrahedronI.H.

Referenced by interpolation< Foam::Vector >::New().

Here is the caller graph for this function:

◆ pointToBarycentric() [1/2]

Foam::barycentric pointToBarycentric ( const point pt) const
inline

Calculate the barycentric coordinates from the given point.

Definition at line 237 of file tetrahedronI.H.

Referenced by cellPointWeight::findTetrahedron().

Here is the caller graph for this function:

◆ pointToBarycentric() [2/2]

Foam::scalar pointToBarycentric ( const point pt,
barycentric bary 
) const
inline

Calculate the barycentric coordinates from the given point.

Returns the determinant.

Definition at line 249 of file tetrahedronI.H.

References Foam::cmptSum(), Foam::det(), Foam::inv(), Foam::mag(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ nearestPoint()

Foam::pointHit nearestPoint ( const point p) const
inline

Return nearest point to p on tetrahedron. Is p itself.

if inside.

Definition at line 292 of file tetrahedronI.H.

References PointHit< Point >::distance(), triangle< Point, PointRef >::nearestPoint(), p, and PointHit< Point >::rawPoint().

Referenced by cellPointWeight::findTetrahedron().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inside()

bool inside ( const point pt) const
inline

Return true if point is inside tetrahedron.

Definition at line 387 of file tetrahedronI.H.

References Foam::mag(), n, and Foam::Zero.

Referenced by polyMeshTetDecomposition::findTet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bounds()

Foam::boundBox bounds
inline

Calculate the bounding box.

Definition at line 463 of file tetrahedronI.H.

References b, Foam::constant::universal::c, Foam::max(), and Foam::min().

Referenced by tetOverlapVolume::cellCellOverlapMinDecomp(), and tetOverlapVolume::cellCellOverlapVolumeMinDecomp().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
tetrahedron< Point, PointRef > &   
)
friend

◆ operator

Ostream& operator ( Ostream ,
const tetrahedron< Point, PointRef > &   
)
friend

The documentation for this class was generated from the following files: