Viewer
A plugin-based viewer for learning Computer Graphics and OpenGL
Face Class Reference

The Face class represents a face of a 3D object. More...

#include <face.h>

List of all members.

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)

Detailed Description

Each face keeps a list of vertices (actually vertex indices) and a normal vector. The face is assumed to be convex.


Constructor & Destructor Documentation

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).


Member Function Documentation

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.

Parameters:
vertscontains 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.


The documentation for this class was generated from the following files:
 All Classes Functions