Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GenericFace.h

Go to the documentation of this file.
00001 
00002 //                            GenericFace.h                                   //
00004 
00005 #ifndef GENERICFACE_H
00006 #define GENERICFACE_H
00007 
00008 #include "MeshTypes.h"
00009 
00010 #include <vector>
00011 #include <iostream>
00012 
00013 namespace X3DTK {
00014 namespace Mesh {
00015 
00016 template<class A, class B, class C> class GenericEdge;
00017 
00019 
00020 template<class FData, class VData, class EData>
00021 class GenericFace
00022 {
00023 public:
00025   GenericFace(unsigned int i, const MGenericEdge<EData, FData, VData> &cEdges)
00026   : _index(i), _cEdges(cEdges), _start(0)
00027   {
00028     if (cEdges.size() == 0)
00029       std::cerr << "Mesh::GenericFace : cannot create a face of 0 edge!" << std::endl;
00030     else
00031       _start = _cEdges.front()->getAVertex();
00032   };
00034   ~GenericFace() {};
00035 
00037   inline unsigned int getIndex() const {return _index;};
00039   const MGenericEdge<EData, FData, VData> &getCEdges()
00040   {
00041     // orienting edges.
00042     MGenericEdge<EData, FData, VData>::iterator it = _cEdges.begin();
00043     GenericVertex<VData, EData, FData> *current = _start;
00044     
00045     while (it != _cEdges.end())
00046     {
00047       if ((*it)->getAVertex() != current)
00048         (*it)->inverseDirection();
00049         
00050       current = (*it)->getBVertex();
00051       ++it;
00052     }
00053           
00054     return _cEdges;
00055   };
00057   inline FData &data() {return _data;};
00059   inline const FData &data() const {return _data;};
00060 
00061 private:
00062   const unsigned int _index;
00063   MGenericEdge<EData, FData, VData> _cEdges;
00064   GenericVertex<VData, EData, FData> *_start;
00065   FData _data;
00066 };
00067 
00068 }
00069 }
00070 
00071 #endif

Generated on Wed Jun 18 14:06:20 2003 for X3DToolKit by doxygen1.3