00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkHEICTriangleMesh_h
00012 #define __mitkHEICTriangleMesh_h
00013
00014 #include "mitkHETriangleMesh.h"
00015
00023 class MITK_COMMON_API mitkHEICTriangleMesh : public mitkHETriangleMesh
00024 {
00025 public:
00026 MITK_TYPE(mitkHEICTriangleMesh, mitkHETriangleMesh)
00027
00028 virtual void PrintSelf(ostream &os);
00029
00033 mitkHEICTriangleMesh();
00034
00039 virtual int GetDataObjectType() const { return MITK_HE_IC_TRIANGLE_MESH; }
00040
00044 virtual void Initialize();
00045
00050 virtual unsigned long long GetActualMemorySize() const;
00051
00056 virtual void ShallowCopy(mitkDataObject *src);
00057
00062 virtual void DeepCopy(mitkDataObject *src);
00063
00070 virtual void SetVertexNumber(size_type number);
00071
00078 virtual void SetFaceNumber(size_type number);
00079
00085 virtual Vertex& GetVertex(VertexHandle v) const
00086 { assert(this->IsValid(v)); return m_Vertices[v.Idx()]; }
00087
00093 virtual Edge& GetEdge(EdgeHandle e) const
00094 { assert(this->IsValid(e)); return m_Edges[e.Idx()]; }
00095
00102 virtual Edge& GetEdge(HalfEdgeHandle he) const
00103 { assert(this->IsValid(he)); return m_Edges[(he.Idx()>>1)]; }
00104
00110 virtual HalfEdge& GetHalfEdge(HalfEdgeHandle he) const
00111 { assert(this->IsValid(he)); return m_Edges[he.Idx()>>1].halfEdge[he.Idx()%2]; }
00112
00118 virtual Face& GetFace(FaceHandle f) const
00119 { assert(this->IsValid(f)); return m_Faces[f.Idx()]; }
00120
00126 virtual VertexHandle GetHandle(Vertex const &vert) const
00127 { return VertexHandle(&vert-m_Vertices); }
00128
00134 virtual EdgeHandle GetHandle(Edge const &edge) const
00135 { return EdgeHandle(&edge-m_Edges); }
00136
00142 virtual HalfEdgeHandle GetHandle(HalfEdge const &he) const
00143 { return this->PairHalfEdge(he.pairHalfEdge); }
00144
00150 virtual FaceHandle GetHandle(Face const &face) const
00151 { return FaceHandle(&face-m_Faces); }
00152
00160 virtual float* GetVertexData();
00161
00172 virtual index_type* GetFaceData();
00173
00179 void ClearTempVertArray();
00180
00186 void ClearTempFaceArray();
00187
00188 protected:
00189 virtual ~mitkHEICTriangleMesh();
00190
00191 virtual size_type _getVertices(index_type startIdx, size_type num, Vertex3f *verts);
00192 virtual size_type _getTriangleFaces(index_type startIdx, size_type num, TriangleFace *faces);
00193 virtual size_type _getTriangleFaces(index_type startIdx, size_type num, Vertex3f *verts);
00194
00195
00196
00197 virtual VertexHandle _addNewVertex(float x, float y, float z,
00198 float nx = 0.0f, float ny = 0.0f, float nz = 0.0f,
00199 HalfEdgeHandle edge = HalfEdgeHandle());
00200 virtual HalfEdgeHandle _addNewEdge(VertexHandle start, VertexHandle end);
00201 virtual FaceHandle _addNewFace(HalfEdgeHandle halfedge = HalfEdgeHandle());
00202
00203
00204 virtual void _clearDeletedVertices();
00205 virtual void _clearDeletedEdges();
00206 virtual void _clearDeletedFaces();
00207
00208
00209 size_type m_Increment;
00210
00211 Vertex *m_Vertices;
00212 Edge *m_Edges;
00213 Face *m_Faces;
00214
00215
00216 Vertex3f *m_VertArray;
00217 TriangleFace *m_FaceArray;
00218
00219 private:
00220 mitkHEICTriangleMesh(const mitkHEICTriangleMesh&);
00221 void operator = (const mitkHEICTriangleMesh&);
00222
00223 };
00224
00225
00226 #endif
00227