Triangle Class Reference

#include <Triangle.h>

Inheritance diagram for Triangle:

Primitive SmoothTriangle TexturedSmoothTriangle

Detailed Description

Inherits from Primitive. This class represents a simple triangle.

Definition at line 16 of file Triangle.h.


Public Member Functions

 Triangle (Vector3D a, Vector3D b, Vector3D c)
 The constructor of the triangle.
virtual ~Triangle ()
 Destructor.
bool Intersect (Ray &ray)
 computes a ray triangle intersection.
virtual Vector3D GetNormal (Ray &ray)
 Gets the normal of the triangle.

Private Member Functions

Box CalcBounds ()
 Calculates the bounding box of that triangle.

Private Attributes

Vector3D a
 The first point of the triangle.
Vector3D b
 The seconf point of the triangle.
Vector3D c
 The third point of the triangle.

Constructor & Destructor Documentation

Triangle::Triangle ( Vector3D  a,
Vector3D  b,
Vector3D  c 
) [inline]

The constructor of the triangle.

Definition at line 60 of file Triangle.h.

virtual Triangle::~Triangle (  )  [inline, virtual]

Destructor.

Definition at line 65 of file Triangle.h.


Member Function Documentation

Box Triangle::CalcBounds (  )  [inline, private, virtual]

Calculates the bounding box of that triangle.

Returns:
The bounding box.

Implements Primitive.

Definition at line 43 of file Triangle.h.

References a, b, Primitive::bounds, c, and Box::Extend().

bool Triangle::Intersect ( Ray ray  )  [inline, virtual]

computes a ray triangle intersection.

Parameters:
ray The ray to test intersection with.
Returns:
True iff the ray hits the surface, false otherwise.

Implements Primitive.

Definition at line 75 of file Triangle.h.

References a, b, c, Cross(), Ray::dir, Dot(), Epsilon, Ray::hit, Ray::org, Ray::t, Ray::u, and Ray::v.

Vector3D Triangle::GetNormal ( Ray ray  )  [inline, virtual]

Gets the normal of the triangle.

Returns:
The normal.

Implements Primitive.

Reimplemented in SmoothTriangle.

Definition at line 116 of file Triangle.h.

References a, b, c, Cross(), and Vector3D::Normalized().


Field Documentation

Vector3D Triangle::a [private]

The first point of the triangle.

Vector3D a

Definition at line 24 of file Triangle.h.

Referenced by CalcBounds(), GetNormal(), and Intersect().

Vector3D Triangle::b [private]

The seconf point of the triangle.

Vector3D b

Definition at line 30 of file Triangle.h.

Referenced by CalcBounds(), GetNormal(), and Intersect().

Vector3D Triangle::c [private]

The third point of the triangle.

Vector3D c

Definition at line 36 of file Triangle.h.

Referenced by CalcBounds(), GetNormal(), and Intersect().


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 21:48:59 2008 for RayTracer by  doxygen 1.5.4