40 #ifndef Foam_triangle_H 41 #define Foam_triangle_H 64 template<
class Po
int,
class Po
intRef>
65 inline Istream&
operator>>(Istream&, triangle<Point, PointRef>&);
67 template<
class Po
int,
class Po
intRef>
68 inline Ostream& operator<<(Ostream&, const triangle<Point, PointRef>&);
90 void front() =
delete;
163 inline scalar
mag()
const;
166 inline scalar
magSqr()
const;
186 template<
class Po
int,
class Po
intRef>
262 inline static point planeIntersection
271 template<
class AboveOp,
class BelowOp>
272 inline static void triSliceWithPlane
355 inline static Pair<Point>
box 383 inline scalar
mag()
const;
386 inline scalar
magSqr()
const;
389 inline Pair<Point>
box()
const;
421 PointRef refPt =
Zero,
483 const scalar tol = 0.0
526 inline int sign(
const point&
p,
const scalar tol = SMALL)
const;
529 template<
class AboveOp,
class BelowOp>
540 template<
class Ins
ideOp,
class Outs
ideOp>
558 friend Ostream& operator<< <Point, PointRef>
scalar sweptVol(const triangle &t) const
Return swept-volume.
const point & c() const noexcept
The third vertex.
A triangle primitive used to calculate face normals and swept volumes. Uses referred points...
barycentric2D pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
A 1D vector of objects of type <T> with a fixed length <N>.
scalar mag() const
The magnitude of the triangle area.
void operator()(const triPoints &)
vector vecC() const
Edge vector opposite point c(): from a() to b()
scalar quality() const
Return quality: Ratio of triangle and circum-circle.
void sliceWithPlane(const plane &pln, AboveOp &aboveOp, BelowOp &belowOp) const
Decompose triangle into triangles above and below plane.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Pair< Point > box() const
The enclosing (bounding) box for the triangle.
vector vecB() const
Edge vector opposite point b(): from c() to a()
tensor inertia(PointRef refPt=Zero, scalar density=1.0) const
Return the inertia tensor, with optional reference.
const Point & a() const noexcept
The first vertex.
Point point_type
The point type.
pointHit nearestPointClassify(const point &p, label &nearType, label &nearLabel) const
Find the nearest point to p on the triangle and classify it:
triPointRef tri() const
Return as triangle reference.
void flip()
Flip triangle orientation by swapping second and third vertices.
triPoints()=default
Default construct.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
const Point & c() const noexcept
The third vertex.
int sign(const point &p, const scalar tol=SMALL) const
The sign for which side of the face plane the point is on.
Point vecB() const
Edge vector opposite point b(): from c() to a()
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant...
FOAM_DEPRECATED_FOR(2018-12, "areaNormal() or unitNormal()") vector normal() const
Legacy name for areaNormal().
void back()=delete
The back() accessor (from FixedList) has no purpose.
triangle(const Point &p0, const Point &p1, const Point &p2)
Construct from three points.
bool classify(const point &p, label &nearType, label &nearLabel) const
Classify nearest point to p in triangle plane.
pointHit nearestPoint(const point &p) const
Return nearest point to p on triangle.
proxType
Proximity classifications.
vector unitNormal() const
Return unit normal.
pointHit ray(const point &p, const vector &q, const intersection::algorithm=intersection::FULL_RAY, const intersection::direction dir=intersection::VECTOR) const
Return point intersection with a ray.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
const Point & b() const noexcept
The second vertex.
Point vecA() const
Edge vector opposite point a(): from b() to c()
Istream & operator>>(Istream &, directionInfo &)
Triangle point storage. Default constructable (triangle is not)
FixedList< triPoints, 27 > triIntersectionList
Storage type for triangles originating from intersecting triangle with another triangle.
scalar magSqr() const
The magnitude squared of the triangle area.
Point centre() const
Return centre (centroid)
scalar mag() const
The magnitude of the triangle area.
Describes the interaction of a object and a (templated) point. It carries the info of a successful hi...
scalar circumRadius() const
Return circum-radius.
void operator()(const triPoints &) const noexcept
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
scalar magSqr() const
The magnitude squared of the triangle area.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void front()=delete
The front() accessor (from FixedList) has no purpose.
vector areaNormal() const
The area normal - with magnitude equal to area of triangle.
const point & a() const noexcept
The first vertex.
Point barycentricToPoint(const barycentric2D &bary) const
Calculate the point from the given barycentric coordinates.
bool intersects(const point &origin, const vector &normal) const
Fast intersection detection with a plane.
void triangleOverlap(const vector &n, const triangle< Point, PointRef > &tri, InsideOp &insideOp, OutsideOp &outsideOp) const
Decompose triangle into triangles inside and outside.
Pair< point > box() const
The enclosing (bounding) box for the triangle.
constexpr sumAreaOp() noexcept
storeOp(triIntersectionList &, label &)
Point vecC() const
Edge vector opposite point c(): from a() to b()
Point circumCentre() const
Return circum-centre.
void operator()(const triPoints &)
vector vecA() const
Edge vector opposite point a(): from b() to c()
triIntersectionList & tris_
Point randomPoint(Random &rndGen) const
Return a random point on the triangle from a uniform distribution.
components
Component labeling enumeration.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
scalar total() const noexcept
Tensor of scalars, i.e. Tensor<scalar>.
const point & b() const noexcept
The second vertex.
vector unitNormal() const
Return unit normal.
const volScalarField & p0
point centre() const
Return centre (centroid)
vector areaNormal() const
The area normal - with magnitude equal to area of triangle.
static constexpr const zero Zero
Global zero (0)