Hauptseite   Übersicht   Auflistung der Dateien   Datenstruktur-Elemente  

Mesh.h

00001 
00002 #include "vtkPolyData.h"
00003 #include "vtkCellArray.h"
00004 #include "vtkRenderer.h"
00005 #include "vtkPolyDataMapper.h"
00006 #include "vtkProperty.h"
00007 
00008 
00009 #include <list>
00010 using namespace std;
00011 
00012 
00013 struct TVertex {
00014         float x,y,z;
00015         TVertex(float c_x,float c_y,float c_z) {x=c_x;y=c_y;z=c_z;}
00016 };//TVertex
00017 
00018 struct TEdge {
00019         int V1,V2;  //2 Vertices
00020         int F1,F2;  //2 Faces
00021         TEdge(int c_V1,int c_V2,int c_F1,int c_F2) { V1=c_V1;V2=c_V2;F1=c_F1;F2=c_F2;}
00022         TEdge(const TEdge &e) { V1=e.V1;V2=e.V2;F1=e.F1;F2=e.F2;}
00023         const TEdge &TEdge::operator= (const TEdge &right) { V1=right.V1;V2=right.V2;F1=right.F1;F2=right.F2;return *this;}
00024 };//TEdge
00025 
00026 typedef list<TEdge*> TEdgeList;
00027 
00028 struct TFace {
00029         int E[4];
00030         TFace(int c_E1,int c_E2,int c_E3,int c_E4) {E[0]=c_E1;E[1]=c_E2;E[2]=c_E3;E[3]=c_E4;}
00031 };//TFace
00032 
00033 typedef list<TVertex*> TVertexList;
00034 typedef list<TFace*> TFaceList;
00035 typedef list<int> TEdgeIDList;
00036 
00037 //new begin
00038 typedef list<int> TVertexIDList;
00039 
00040 struct T3DFace {
00041         TVertexIDList vidl;
00042         T3DFace(TVertexIDList *eingabe) {
00043                 TVertexIDList::iterator it;
00044                 for(it=eingabe->begin();it!=eingabe->end();it++)
00045                         vidl.insert(vidl.end(),*it);
00046 
00047         }
00048 };//T3DFace
00049 
00050 typedef list<T3DFace*> T3DFaceList;
00051 
00052 
00053 
00054 
00066 class CMesh
00067 {
00068 private:
00069         TVertexList VertexList;
00070         TEdgeList EdgeList;
00071         TFaceList FaceList;
00072         T3DFaceList FaceList3D;
00073         int num_v, num_e, num_f;
00074         float *VertexArray;
00075         int *EdgeArray;
00076         int *FaceArray;
00077 
00078         vtkPolyData *PolyData;
00079         vtkPoints *Points;
00080         vtkPolyData *CCPolyData;
00081         vtkActor *CCActor;
00082         vtkPolyDataMapper *CCMapper;
00083 
00084         TEdge *GetEdge(int n);
00085         TVertex *GetVertex(int n);
00086 
00087         void AddVertex(TVertex *v);
00088         void AddEdge(TEdge *e);
00089         void AddFace(TFace *f);
00090         void Add3DFace(T3DFace *f);
00091         int EdgeExists(int v1, int v2);
00092 protected:
00093         void ListToArray();
00094         void Changefrom3D();
00095 public:
00096         CMesh();
00097         ~CMesh();
00098 
00105         int LoadFromFile(char *Filename);
00106         
00107 
00114         void Render();
00115 
00120         vtkPolyData *GetPolyData();
00121 
00130         CMesh *CatmullClark(int SumType);
00131 
00136         void Clear();
00137 };//CMesh

Erzeugt am Sun Jun 22 12:07:28 2003 für CatmullClark von doxygen1.3