Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Face.cpp

Go to the documentation of this file.
00001 #include "Face.h"
00002 
00003 using namespace model;
00004 
00005 
00027 Face::Face(Vertex* vertex1, Vertex* vertex2) {
00028         setVertices(vertex1, vertex2);
00029 }
00030 
00055 Face::Face(Vertex* vertex1, Vertex* vertex2, Vertex* vertex3) {
00056         setVertices(vertex1, vertex2, vertex3);
00057 }
00058 
00086 Face::Face(Vertex* vertex1, Vertex* vertex2, Vertex* vertex3, Vertex* vertex4) {
00087         setVertices(vertex1, vertex2, vertex3, vertex4);
00088 }
00089 
00108 Face::Face(const Face& other) {
00109     m_vertices = other.m_vertices;
00110         m_iCount = other.m_iCount;
00111 }  
00112 
00134 Face& Face::operator=(const Face& other)
00135 {
00136     // if same object
00137     if ( this == &other )
00138         return *this;
00139         
00140     m_vertices = other.m_vertices;
00141         m_iCount = other.m_iCount;
00142 
00143     return *this;
00144 }  
00145 
00167 void Face::setVertex(int iIndex, Vertex* vertex) {
00168                 m_vertices[iIndex] = vertex;
00169 }
00170 
00192 void Face::setVertices(Vertex* vertex1, Vertex* vertex2) {
00193         m_iCount = 2;
00194         m_vertices.push_back(vertex1);
00195         m_vertices.push_back(vertex2);
00196 }
00197 
00222 void Face::setVertices(Vertex* vertex1, Vertex* vertex2, Vertex* vertex3) {
00223         m_iCount = 3;
00224         m_vertices.push_back(vertex1);
00225         m_vertices.push_back(vertex2);
00226         m_vertices.push_back(vertex3);
00227 }
00228 
00256 void Face::setVertices(Vertex* vertex1, Vertex* vertex2, Vertex* vertex3, Vertex* vertex4) {
00257         m_iCount = 4;
00258         m_vertices.push_back(vertex1);
00259         m_vertices.push_back(vertex2);
00260         m_vertices.push_back(vertex3);
00261         m_vertices.push_back(vertex4);
00262 }
00263 
00285 Vertex* Face::getVertex(int iIndex) {
00286         return m_vertices[iIndex];
00287 }
00288 
00307 IvVector3 Face::computeNormal() {
00308         return IvVector3();
00309 }
00310 
00332 bool Face::operator==( const Face& other ) const
00333 {
00334     if(other.m_vertices[0] == m_vertices[0] 
00335         && other.m_vertices[1] == m_vertices[1] 
00336         && other.m_vertices[2] == m_vertices[2]
00337         && other.m_vertices[3] == m_vertices[3]
00338         && other.m_iCount == m_iCount) {
00339         return true;
00340         }
00341     return false;  
00342 }   
00343 
00365 bool Face::operator!=( const Face& other ) const
00366 {
00367         if(other.m_vertices[0] == m_vertices[0] 
00368         && other.m_vertices[1] == m_vertices[1] 
00369         && other.m_vertices[2] == m_vertices[2]
00370         && other.m_vertices[3] == m_vertices[3]
00371         && other.m_iCount == m_iCount) {
00372         return false;
00373         }
00374     return true;
00375 }  
00376 
00395 int Face::getCount() {
00396         return m_iCount;
00397 }
00398 
00417 vector<Vertex*> Face::getVertices() {
00418         return m_vertices;
00419 }
00420 

Generated on Tue Apr 17 09:39:12 2007 for PCG Library by  doxygen 1.3.9.1