Triangle Class Reference

#include <Triangle.h>

Inherits Primitive.

Inherited by TexturedSmoothTriangle.

Inheritance diagram for Triangle:

Inheritance graph
[legend]
Collaboration diagram for Triangle:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Triangle (const Vec3f &a, const Vec3f &b, const Vec3f &c)
virtual ~Triangle ()
bool intersect (Ray &ray) const
virtual Vec3f normal (const Ray &ray) const
void axes (const Ray &, Vec3f &x, Vec3f &y) const

Protected Member Functions

virtual void calcBounds ()

Protected Attributes

Vec3f mA
 Vertices.
Vec3f mB
Vec3f mC
Vec3f mEdge1
 axis needed for bump mapping (and could be useful for some other stuff)
Vec3f mEdge2

Detailed Description

A simple triangle

Author:
Alex Busenius

Christian Engels

Definition at line 15 of file Triangle.h.


Constructor & Destructor Documentation

Triangle::Triangle ( const Vec3f a,
const Vec3f b,
const Vec3f c 
) [inline]

Constructor

Definition at line 20 of file Triangle.h.

References calcBounds().

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

Destructor

Definition at line 35 of file Triangle.h.


Member Function Documentation

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

Intersects with the ray and sets ray.hit and ray.t to the appropiate values

Returns:
true if something hit, false if not

Implements Primitive.

Definition at line 43 of file Triangle.h.

References Vec3f::cross(), Ray::dir(), Vec3f::dot(), EPSILON, mA, mEdge1, mEdge2, Ray::org(), Ray::setHit(), Ray::setUV(), and Ray::t().

virtual Vec3f Triangle::normal ( const Ray ray  )  const [inline, virtual]

Calculate a normal in global coordinates given barycentric coordinates of the hitpoint

Returns:
Returns the normal

Implements Primitive.

Reimplemented in TexturedSmoothTriangle.

Definition at line 82 of file Triangle.h.

References Vec3f::cross(), Ray::hit(), mA, mB, mC, Vec3f::normal(), Ray::obj(), and PhysicalObject::toGlobalCoordinates().

void Triangle::axes ( const Ray ,
Vec3f x,
Vec3f y 
) const [inline, virtual]

gives axis of the triangle (perpendicular to the normal) this is used in bump mapping

See also:
Shader::normal()

Implements Primitive.

Definition at line 98 of file Triangle.h.

References mEdge1, mEdge2, and Vec3f::normal().

virtual void Triangle::calcBounds (  )  [inline, protected, virtual]

Calculate bounds

Implements Primitive.

Definition at line 129 of file Triangle.h.

References Box::extend(), mA, mB, Primitive::mBounds, and mC.

Referenced by Triangle().


Member Data Documentation

Vec3f Triangle::mA [protected]

Vertices.

Definition at line 121 of file Triangle.h.

Referenced by calcBounds(), intersect(), and normal().

Vec3f Triangle::mB [protected]

Definition at line 121 of file Triangle.h.

Referenced by calcBounds(), and normal().

Vec3f Triangle::mC [protected]

Definition at line 121 of file Triangle.h.

Referenced by calcBounds(), and normal().

Vec3f Triangle::mEdge1 [protected]

axis needed for bump mapping (and could be useful for some other stuff)

Definition at line 124 of file Triangle.h.

Referenced by axes(), and intersect().

Vec3f Triangle::mEdge2 [protected]

Definition at line 124 of file Triangle.h.

Referenced by axes(), and intersect().


The documentation for this class was generated from the following file:
Generated on Fri Feb 1 00:02:34 2008 for Grayfall by  doxygen 1.5.1