Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Triangle.h

00001 // Mesh Algorithms: a library of algorithms to manipulate 3D meshes
00002 // Copyright (C) 2001 Tim Garthwaite and Jason Reposa
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 #ifndef TRIANGLE_H
00019 #define TRIANGLE_H
00020 
00021 class Triangle;
00022 
00023 #include "options.h"
00024 #include <string>
00025 #include "Vertex.h"
00026 #include "Normal.h"
00027 #include "Color.h"
00028 #include "Point.h"
00029 #include <GL/gl.h>
00030 
00032 class Triangle {
00033   Vertex * v[3]; 
00034   Color color; 
00035   Normal normal; 
00036   Point center; 
00037   bool replaced_before; 
00038 
00040   GLvoid calculateColor(Vertex * v0, Vertex * v1, Vertex * v2);
00041 
00043   GLvoid calculateNormal(Vertex * v0, Vertex * v1, Vertex * v2);
00044 
00046   GLvoid calculateCenter(Vertex * v0, Vertex * v1, Vertex * v2);
00047 
00048  public:
00049 
00051 
00055   Triangle(
00056     Vertex * v0, 
00057     Vertex * v1, 
00058     Vertex * v2  
00059   );
00060 
00061   Vertex * v0(); 
00062   Vertex * v1(); 
00063   Vertex * v2(); 
00064 
00066   GLvoid setColor(Color * c);
00067 
00069   Color * getColor();
00070 
00072   GLvoid setNormal(Normal * n);
00073   Normal * getNormal();
00074 
00075   GLvoid setCenter(Point * c);
00076   Point * getCenter();
00077 
00078   bool replaced();
00079   bool replace(Vertex * v1, Vertex *v2);
00080 
00081   std::string toString();
00082   bool contains(Vertex * v1);
00083 
00084 };
00085 
00086 #endif

Generated on Fri Dec 21 00:16:49 2001 for Mesh Decimation by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001