OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

triangle< Point, PointRef > Class Template Reference

A triangle primitive used to calculate face normals and swept volumes. More...

List of all members.


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

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

Detailed Description

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

A triangle primitive used to calculate face normals and swept volumes.

Source files

Definition at line 70 of file triangle.H.


Member Enumeration Documentation

enum proxType

Return types for classify.

Enumerator:
NONE 
POINT 
EDGE 

Definition at line 97 of file triangle.H.


Constructor & Destructor Documentation

triangle ( const Point &  a,
const Point &  b,
const Point &  c 
) [inline]

Construct from three points.

Definition at line 183 of file triangleI.H.

triangle ( Istream is  )  [inline]

Construct from Istream.

Definition at line 196 of file triangleI.H.


Member Function Documentation

const Point & a (  )  const [inline]

Return first vertex.

Definition at line 214 of file triangleI.H.

const Point & b (  )  const [inline]

Return second vertex.

Definition at line 220 of file triangleI.H.

const Point & c (  )  const [inline]

Return third vertex.

Definition at line 226 of file triangleI.H.

Point centre (  )  const [inline]

Return centre (centroid).

Definition at line 233 of file triangleI.H.

scalar mag (  )  const [inline]

Return scalar magnitude.

Definition at line 240 of file triangleI.H.

Referenced by triangle< Point, PointRef >::normal().

Here is the caller graph for this function:

vector normal (  )  const [inline]

Return vector normal.

Definition at line 247 of file triangleI.H.

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

Here is the call graph for this function:

vector circumCentre (  )  const [inline]

Return circum-centre.

Definition at line 254 of file triangleI.H.

scalar circumRadius (  )  const [inline]

Return circum-radius.

Definition at line 274 of file triangleI.H.

scalar quality (  )  const [inline]

Return quality: Ratio triangle and circum-circle area.

Definition at line 296 of file triangleI.H.

References Foam::max(), Foam::min(), and Foam::sqrt().

Here is the call graph for this function:

scalar sweptVol ( const triangle< Point, PointRef > &  t  )  const [inline]

Return swept-volume.

Definition at line 310 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 327 of file triangleI.H.

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 443 of file triangleI.H.

pointHit nearestPoint ( const point p  )  const [inline]

Return nearest point to p on triangle.

Definition at line 526 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.

  • inside (true returned)/outside (false returned)
  • near point (nearType=POINT, nearLabel=0, 1, 2)
  • near edge (nearType=EDGE, nearLabel=0, 1, 2) Note: edges are counted from starting vertex so e.g. edge 2 is from f[2] to f[0] tol is fraction to account for truncation error. Is only used when comparing normalized (0..1) numbers.

Definition at line 541 of file triangleI.H.


Friends And Related Function Documentation

Istream& operator>> ( Istream ,
triangle< Point, PointRef > &   
) [friend]

Ostream& operator ( Ostream ,
const triangle< Point, PointRef > &   
) [friend]


The documentation for this class was generated from the following files:
  • src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H
  • src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H
Copyright © 2000-2009 OpenCFD Ltd