MeshTriangle Class Reference

Basic representation of a MeshTriangle with optional UV coordinates. More...

#include <MeshTriangle.h>

Inheritance diagram for MeshTriangle:

Intersectable MeshTriangleFast

List of all members.

Public Member Functions

Constructors
 MeshTriangle ()
 MeshTriangle (unsigned A_, unsigned B_, unsigned C_, unsigned nA_=0, unsigned nB_=0, unsigned nC_=0, unsigned tA_=0, unsigned tB_=0, unsigned tC_=0)
 MeshTriangle (const MeshTriangle &copy)
Core functionality
virtual real_t getIntersection (const Ray &ray, SurfacePoint &pt)
 Initializes this triangle for intersection tests.
virtual AABB getAABB () const
Vector3 getNormal () const
Vector3 getBaryocentricCoords (const Point3 &p) const
Sampling functionality
void getRandomPoint (SurfacePoint &pt)
Point3 getPosition (const UV &uv)
real_t getSurfaceArea () const

Public Attributes

unsigned A
unsigned B
unsigned C
unsigned data [3]
unsigned nA
unsigned nB
unsigned nC
unsigned nData [3]
unsigned tA
unsigned tB
unsigned tC
unsigned tData [3]
Fast-access public data
union {
   struct {
      unsigned   A
      unsigned   B
      unsigned   C
   } 
   unsigned   data [3]
}; 
union {
   struct {
      unsigned   nA
      unsigned   nB
      unsigned   nC
   } 
   unsigned   nData [3]
}; 
union {
   struct {
      unsigned   tA
      unsigned   tB
      unsigned   tC
   } 
   unsigned   tData [3]
}; 
Meshmesh


Detailed Description

Basic representation of a MeshTriangle with optional UV coordinates.

Author:
Travis Fischer (fisch0920@gmail.com)

Nong Li (nongli@gmail.com)

Date:
Spring 2008
See also:
also Triangle.h which defines a Triangle class which derives from Shape and differs from MeshTriangle in that it is a standalone Shape and doesn't depend on a parent Mesh to exist

Definition at line 30 of file MeshTriangle.h.


Constructor & Destructor Documentation

MeshTriangle::MeshTriangle (  )  [inline]

Definition at line 67 of file MeshTriangle.h.

MeshTriangle::MeshTriangle ( unsigned  A_,
unsigned  B_,
unsigned  C_,
unsigned  nA_ = 0,
unsigned  nB_ = 0,
unsigned  nC_ = 0,
unsigned  tA_ = 0,
unsigned  tB_ = 0,
unsigned  tC_ = 0 
) [inline]

Definition at line 73 of file MeshTriangle.h.

MeshTriangle::MeshTriangle ( const MeshTriangle copy  )  [inline]

Definition at line 81 of file MeshTriangle.h.


Member Function Documentation

real_t MeshTriangle::getIntersection ( const Ray ray,
SurfacePoint pt 
) [virtual]

Initializes this triangle for intersection tests.

Implements Intersectable.

Reimplemented in MeshTriangleFast.

Definition at line 90 of file MeshTriangle.cpp.

AABB MeshTriangle::getAABB (  )  const [virtual]

Implements Intersectable.

Definition at line 184 of file MeshTriangle.cpp.

Vector3 MeshTriangle::getNormal (  )  const

Definition at line 172 of file MeshTriangle.cpp.

Vector3 MeshTriangle::getBaryocentricCoords ( const Point3 p  )  const

Definition at line 342 of file MeshTriangle.cpp.

void MeshTriangle::getRandomPoint ( SurfacePoint pt  ) 

Returns:
a point chosen uniformly random over the surface of this shape in 'pt'
Note:
the probability density of selecting this point is assumed to be (1.0 / getSurfaceArea())

Definition at line 279 of file MeshTriangle.cpp.

Point3 MeshTriangle::getPosition ( const UV uv  ) 

Returns:
the point on the surface of this shape corresponding to the given UV coordinates

Definition at line 297 of file MeshTriangle.cpp.

real_t MeshTriangle::getSurfaceArea (  )  const

Returns:
the total surface area of this shape

Definition at line 333 of file MeshTriangle.cpp.


Member Data Documentation

unsigned MeshTriangle::A

Definition at line 38 of file MeshTriangle.h.

unsigned MeshTriangle::B

Definition at line 38 of file MeshTriangle.h.

unsigned MeshTriangle::C

Definition at line 38 of file MeshTriangle.h.

unsigned MeshTriangle::data[3]

Definition at line 41 of file MeshTriangle.h.

union { ... }

unsigned MeshTriangle::nA

Definition at line 46 of file MeshTriangle.h.

unsigned MeshTriangle::nB

Definition at line 46 of file MeshTriangle.h.

unsigned MeshTriangle::nC

Definition at line 46 of file MeshTriangle.h.

unsigned MeshTriangle::nData[3]

Definition at line 49 of file MeshTriangle.h.

union { ... }

unsigned MeshTriangle::tA

Definition at line 54 of file MeshTriangle.h.

unsigned MeshTriangle::tB

Definition at line 54 of file MeshTriangle.h.

unsigned MeshTriangle::tC

Definition at line 54 of file MeshTriangle.h.

unsigned MeshTriangle::tData[3]

Definition at line 57 of file MeshTriangle.h.

union { ... }

Definition at line 60 of file MeshTriangle.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6