00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __Mesh_h__
00014 #define __Mesh_h__
00015
00016 #include <vector>
00017 #include <map>
00018 #include <set>
00019 #include <iostream>
00020 #include <iomanip>
00021 #include <utility>
00022
00023 #include "definitions.h"
00024 #include "CompTraits.h"
00025
00026
00027
00028 namespace subdiv {
00029
00030 template <typename V> class AveragingBasic;
00031
00032 template <typename T, typename V, typename E, typename TT>
00033 class Mesh {
00034 public:
00035 Mesh(){}
00036 ~Mesh(){}
00037
00038
00039 typedef std::set<E*, typename Comptrait<E>::comp_t, std::allocator<E*> > EdgeSet;
00040 typedef std::map<T*, TT* > TriangleTTreeMap;
00041
00042
00043 typedef typename std::vector<V* >::iterator VertexIterator;
00044 typedef typename std::vector<T* >::iterator TriangleIterator;
00045
00046 VertexIterator vBegin(){return _m_vc.begin();}
00047 VertexIterator vEnd(){return _m_vc.end();}
00048 TriangleIterator tBegin(){return _m_tc.begin();}
00049 TriangleIterator tEnd(){return _m_tc.end();}
00050
00051
00052 void addVertex(V* v) {_m_vc.push_back(v);}
00053 void addTriangle(T* t) {_m_tc.push_back(t);}
00054
00055 void buildTriangleTopology();
00056 void subdivide(Averaging<V> *avrg);
00057
00058
00059 template <typename T2, typename V2, typename E2, typename TT2>
00060 friend void operator>>(std::istream&, Mesh<T2, V2, E2, TT2>& );
00061 template <typename T2, typename V2, typename E2, typename TT2>
00062 friend void operator<<(std::ostream&, Mesh<T2, V2, E2, TT2>& );
00063
00064 private:
00065 std::vector<V* > _m_vc;
00066 std::vector<T* > _m_tc;
00067 TriangleTTreeMap _m_tt;
00068
00069
00070 void addOrMatch(EdgeSet*& , V*, V* , T *);
00071 };
00072
00073 #include "Mesh.cc"
00074 }
00075
00076 #endif