#include <Triangle.h>
Inherits Primitive.
Inherited by TexturedSmoothTriangle.
Inheritance diagram for Triangle:
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 |
Definition at line 15 of file Triangle.h.
virtual Triangle::~Triangle | ( | ) | [inline, virtual] |
Destructor
Definition at line 35 of file Triangle.h.
bool Triangle::intersect | ( | Ray & | ray | ) | const [inline, virtual] |
Intersects with the ray and sets ray.hit and ray.t to the appropiate values
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().
Calculate a normal in global coordinates given barycentric coordinates of the hitpoint
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().
gives axis of the triangle (perpendicular to the normal) this is used in bump mapping
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().
Vec3f Triangle::mA [protected] |
Vertices.
Definition at line 121 of file Triangle.h.
Referenced by calcBounds(), intersect(), and normal().
Vec3f Triangle::mB [protected] |
Vec3f Triangle::mC [protected] |
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] |