A triangle primitive used to calculate face normals and swept volumes. More...
#include <OpenFOAM/triangle.H>
A triangle primitive used to calculate face normals and swept volumes.
Definition at line 75 of file triangle.H.
Public Types | |
enum | proxType { NONE, POINT, EDGE } |
Return types for classify. More... | |
Public Member Functions | |
triangle (const Point &a, const Point &b, const Point &c) | |
Construct from three points.
| |
triangle (Istream &) | |
Construct from Istream.
| |
const Point & | a () const |
Return first vertex.
| |
const Point & | b () const |
Return second vertex.
| |
const Point & | c () const |
Return third vertex.
| |
Point | centre () const |
Return centre (centroid)
| |
scalar | mag () const |
Return scalar magnitude.
| |
vector | normal () const |
Return vector normal.
| |
vector | circumCentre () const |
Return circum-centre.
| |
scalar | circumRadius () const |
Return circum-radius.
| |
scalar | quality () const |
Return quality: Ratio triangle and circum-circle area.
| |
scalar | sweptVol (const triangle &t) const |
Return swept-volume.
| |
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.
| |
pointHit | intersection (const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const |
Fast intersection with a ray.
| |
pointHit | nearestPoint (const point &p) const |
Return nearest point to p on triangle.
| |
bool | classify (const point &p, const scalar tol, label &nearType, label &nearLabel) const |
Classify point in triangle plane w.r.t. triangle edges.
| |
Friends | |
Istream & | operator>> (Istream &, triangle &) |
Ostream & | operator (Ostream &, const triangle &) |
enum proxType |
triangle | ( | const Point & | a, |
const Point & | b, | ||
const Point & | c | ||
) | [inline]
|
Construct from three points.
Definition at line 191 of file triangleI.H.
Construct from Istream.
Definition at line 204 of file triangleI.H.
References IOstream::check(), Istream::readBegin(), and Istream::readEnd().
const Point & a | ( | ) | const [inline]
|
Return first vertex.
Definition at line 222 of file triangleI.H.
Referenced by triSurfaceTools::calcInterpolationWeights().
const Point & b | ( | ) | const [inline]
|
Return second vertex.
Definition at line 228 of file triangleI.H.
Referenced by triSurfaceTools::calcInterpolationWeights().
const Point & c | ( | ) | const [inline]
|
Return third vertex.
Definition at line 234 of file triangleI.H.
Referenced by triSurfaceTools::calcInterpolationWeights().
Point centre | ( | ) | const [inline]
|
Return centre (centroid)
Definition at line 241 of file triangleI.H.
scalar mag | ( | ) | const [inline]
|
Return vector normal.
Definition at line 255 of file triangleI.H.
vector circumCentre | ( | ) | const [inline]
|
Return circum-centre.
Definition at line 262 of file triangleI.H.
scalar circumRadius | ( | ) | const [inline]
|
Return circum-radius.
Definition at line 282 of file triangleI.H.
References Foam::mag(), Foam::max(), Foam::min(), and Foam::sqrt().
scalar quality | ( | ) | const [inline]
|
Return quality: Ratio triangle and circum-circle area.
Definition at line 304 of file triangleI.H.
References Foam::mag(), Foam::mathematicalConstant::pi(), and Foam::sqr().
scalar sweptVol | ( | const triangle< Point, PointRef > & | t ) | const [inline]
|
Return swept-volume.
Definition at line 318 of file triangleI.H.
pointHit ray | ( | const point & | p, |
const vector & | q, | ||
const intersection::algorithm | alg = intersection::FULL_RAY ,
|
||
const intersection::direction | dir = intersection::VECTOR
|
||
) | const [inline]
|
Return point intersection with a ray.
For a hit, the distance is signed. Positive number represents the point in front of triangle. In case of miss pointHit is set to nearest point on triangle and its distance to the distance between the original point and the plane intersection point
Definition at line 335 of file triangleI.H.
References intersection::CONTACT_SPHERE, dist, intersection::FULL_RAY, intersection::HALF_RAY, PointHit< Point >::hit(), Foam::mag(), Foam::min(), p, intersection::planarTol(), PointHit< Point >::rawPoint(), PointHit< Point >::setDistance(), PointHit< Point >::setHit(), PointHit< Point >::setMiss(), PointHit< Point >::setPoint(), intersection::VECTOR, and intersection::VISIBLE.
Referenced by octreeDataTriSurface::intersects().
pointHit intersection | ( | const point & | p, |
const vector & | q, | ||
const intersection::algorithm | alg, | ||
const scalar | tol = 0.0
|
||
) | const [inline]
|
Fast intersection with a ray.
For a hit, the pointHit.distance() is the line parameter t : intersection=p+t*q. Only defined for VISIBLE, FULL_RAY or HALF_RAY. tol increases the virtual size of the triangle by a relative factor.
Definition at line 451 of file triangleI.H.
References Foam::det(), intersection::FULL_RAY, intersection::HALF_RAY, PointHit< Point >::setDistance(), PointHit< Point >::setHit(), PointHit< Point >::setPoint(), intersection::VISIBLE, and Vector< Cmpt >::zero.
Referenced by treeDataTriSurface::intersects().
Return nearest point to p on triangle.
Definition at line 534 of file triangleI.H.
bool classify | ( | const point & | p, |
const scalar | tol, | ||
label & | nearType, | ||
label & | nearLabel | ||
) | const [inline]
|
Classify point in triangle plane w.r.t. triangle edges.
near point (nearType=POINT, nearLabel=0, 1, 2)
Definition at line 549 of file triangleI.H.
References beta(), Foam::mag(), Foam::max(), Foam::min(), v1, v2, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Referenced by triSurfaceTools::calcInterpolationWeights().