#include <triangle.h>
Inherits Intersectable.
Inheritance diagram for Triangle:
Public Member Functions | |
Triangle () | |
Constructor. | |
Triangle (Mesh *owner, const Mesh::vertex &vtx1, const Mesh::vertex &vtx2, const Mesh::vertex &vtx3) | |
Constructor initializing the triangle with the given vertices. | |
Vector | getFaceNormal () const |
Compute the triangle's face normal from the position of its vertices. | |
float | getArea () const |
Return the area of the triangle. | |
bool | intersect (const Ray &ray) const |
Returns true if the ray intersects the triangle. | |
bool | intersect (const Ray &ray, Intersection &isect) const |
Returns true if the ray intersects the triangle. | |
const Point & | getVtxPosition (int i) const |
Returns the position of vertex i=[0,1,2]. | |
const Vector & | getVtxNormal (int i) const |
Returns the normal of vertex i=[0,1,2]. | |
const UV & | getVtxTexture (int i) const |
Returns the texture coordinate of vertex i=[0,1,2]. | |
Protected Attributes | |
Mesh * | mMesh |
Ptr to the mesh this triangle belongs to. | |
Mesh::vertex | mVtx [3] |
The three vertices of the triangle. |