The Face class represents a face of a 3D object. More...
#include <face.h>
Public Member Functions | |
| Face () | |
| Face (int i0, int i1, int i2, int i3=-1) | |
| void | addVertexIndex (int i) |
| int | numVertices () const |
| int | vertexIndex (int i) const |
| Vector | normal () const |
| void | computeNormal (const vector< Vertex > &verts) |
Each face keeps a list of vertices (actually vertex indices) and a normal vector. The face is assumed to be convex.
| Face::Face | ( | ) |
Constructs an empty face.
| Face::Face | ( | int | i0, |
| int | i1, | ||
| int | i2, | ||
| int | i3 = -1 |
||
| ) |
Constructs a face with 3 or 4 vertices (actually vertex indices).
| void Face::addVertexIndex | ( | int | i | ) |
Adds a new vertex index i to the face (at the end, i.e. push_back).
| void Face::computeNormal | ( | const vector< Vertex > & | verts | ) |
Recomputes the normal vector of the face. This method must be called explicitly after constructing/modifying the face.
| verts | contains actual vertex coordinates from the object containing the face. |
| Vector Face::normal | ( | ) | const |
Returns the current normal vector of the face (undefined by default). The return value is thus undefined unless computeNormal() has been called for this face.
| int Face::numVertices | ( | ) | const |
Returns the number of vertices forming the face.
| int Face::vertexIndex | ( | int | i | ) | const |
Returns the vertex index at the i-th position. First vertex has index 0.