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

GenericEdge.h

Go to the documentation of this file.
00001 
00002 //                            GenericEdge.h                                   //
00004 
00005 #ifndef GENERICEDGE_H
00006 #define GENERICEDGE_H
00007 
00008 #include "MeshTypes.h"
00009 
00010 #include <vector>
00011 
00012 namespace X3DTK {
00013 namespace Mesh {
00014 
00015 template<class A, class B, class C> class GenericVertex;
00016 template<class A, class B, class C> class GenericFace;
00017 
00019 
00020 template<class EData, class FData, class VData>
00021 class GenericEdge
00022 {
00023   template<class A, class B, class C, class D> friend class TemplateMesh;
00024 public:
00026   GenericEdge(GenericVertex<VData, EData, FData> *const A, GenericVertex<VData, EData, FData> *const B) 
00027   : _direction(true), _v1(A), _v2(B)
00028   {};
00030   ~GenericEdge() {};
00031 
00033   void inverseDirection() {_direction = !_direction;};
00034 
00036   inline GenericVertex<VData, EData, FData> *const getAVertex() const {return (_direction ? _v1 : _v2);};
00038   inline GenericVertex<VData, EData, FData> *const getBVertex() const {return (_direction ? _v2 : _v1);};
00040   inline const MGenericFace<FData, VData, EData> &getLeftFaces() const {return (_direction ? _r1Faces : _r2Faces);};
00042   inline const MGenericFace<FData, VData, EData> &getRightFaces() const {return (_direction ? _r2Faces: _r1Faces);};
00044   inline bool getDirection() const {return _direction;};
00046   inline EData &data() {return _data;};
00048   inline const EData &data() const {return _data;};
00049 
00050 private:
00051   bool _direction;
00052   GenericVertex<VData, EData, FData> *const _v1;
00053   GenericVertex<VData, EData, FData> *const _v2;
00054   MGenericFace<FData, VData, EData> _r1Faces;
00055   MGenericFace<FData, VData, EData> _r2Faces;
00056   EData _data;
00057   
00059   void addLeftFace(GenericFace<FData, VData, EData> *face) 
00060   {
00061     if (_direction)
00062     {
00063       _r1Faces.back() = face;
00064       _r1Faces.push_back((GenericFace<FData, VData, EData> *)(0x1));
00065     }  
00066     else
00067     {
00068       _r2Faces.back() = face;
00069       _r2Faces.push_back((GenericFace<FData, VData, EData> *)(0x1));
00070     }  
00071   };
00073   void addRightFace(GenericFace<FData, VData, EData> *face) 
00074   {
00075     if (_direction)
00076     {
00077       _r2Faces.back() = face;
00078       _r2Faces.push_back((GenericFace<FData, VData, EData> *)(0x1));
00079     }  
00080     else
00081     {
00082       _r1Faces.back() = face;
00083       _r1Faces.push_back((GenericFace<FData, VData, EData> *)(0x1));
00084     }  
00085   };
00086 
00087 };
00088 
00089 }
00090 }
00091 
00092 #endif

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