Atoms Crowd  4.1.0
AtomsUtils::Triangle Class Reference

Triangle class. More...

#include <Triangle.h>

Public Member Functions

 Triangle ()
 Constructor.
 
 Triangle (const AtomsMath::Vector3f &v0, const AtomsMath::Vector3f &v1, const AtomsMath::Vector3f &v2, unsigned int id=0)
 Constructor. More...
 
 ~Triangle ()
 Destructor.
 
AtomsMath::Vector3f midPoint ()
 Get triangle mid point.
 
AtomsMath::Box3f bbox ()
 Get triangle bounding box.
 
AtomsMath::Vector3f barycentric (const AtomsMath::Vector3f &point)
 Get the barycentric coordinates of the given point.
 
bool intersect (const AtomsMath::Vector3f &orig, const AtomsMath::Vector3f &dir, float &t, float &u, float &v)
 Ray/triangle intersector. More...
 
bool intersect (const AtomsMath::Box3f &bbox)
 Triange/BBox intersector. More...
 
AtomsMath::Vector3f closestPoint (const AtomsMath::Vector3f &inP, float &outU, float &outV, float &sqrDistance)
 ! Closest point
 

Public Attributes

AtomsMath::Box3f boundingbox
 Triangle bounding box.
 
AtomsMath::Vector3f p0
 Vertex 0.
 
AtomsMath::Vector3f p1
 Vertex 1.
 
AtomsMath::Vector3f p2
 Vertex 2.
 
unsigned int id
 Triangle id.
 

Detailed Description

Triangle class.

Constructor & Destructor Documentation

◆ Triangle()

AtomsUtils::Triangle::Triangle ( const AtomsMath::Vector3f &  v0,
const AtomsMath::Vector3f &  v1,
const AtomsMath::Vector3f &  v2,
unsigned int  id = 0 
)

Constructor.

Parameters
v0Vertex 0
v1Vertex 1
v2Vertex 2
idTriangle id

Member Function Documentation

◆ intersect() [1/2]

bool AtomsUtils::Triangle::intersect ( const AtomsMath::Box3f &  bbox)

Triange/BBox intersector.

Parameters
bboxBoungind box
Returns
True if there is a intersection

◆ intersect() [2/2]

bool AtomsUtils::Triangle::intersect ( const AtomsMath::Vector3f &  orig,
const AtomsMath::Vector3f &  dir,
float &  t,
float &  u,
float &  v 
)

Ray/triangle intersector.

Parameters
origRay origin
dirRay direction
tParametric coord of the interseciton point
uBaricentric u coord of the intersection point
vBaricentric v coord of the intersection point \ return True if there is an intersection

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