00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef OPENMESH_TRIMESH_HH
00040 #define OPENMESH_TRIMESH_HH
00041
00042
00043
00044
00045
00046 #include <OpenMesh/Core/System/config.h>
00047 #include <OpenMesh/Core/Mesh/PolyMeshT.hh>
00048 #include <vector>
00049
00050
00051
00052
00053
00054 namespace OpenMesh {
00055
00056
00057
00058
00059
00076 template <class Kernel>
00077 class TriMeshT : public PolyMeshT<Kernel>
00078 {
00079
00080 public:
00081
00082
00083
00084 typedef TriMeshT<Kernel> This;
00085 typedef PolyMeshT<Kernel> PolyMesh;
00086
00087
00088
00089
00090 typedef typename PolyMesh::Scalar Scalar;
00091 typedef typename PolyMesh::Point Point;
00092 typedef typename PolyMesh::Normal Normal;
00093 typedef typename PolyMesh::Color Color;
00094 typedef typename PolyMesh::TexCoord TexCoord;
00095 typedef typename PolyMesh::Vertex Vertex;
00096 typedef typename PolyMesh::Halfedge Halfedge;
00097 typedef typename PolyMesh::Edge Edge;
00098 typedef typename PolyMesh::Face Face;
00099
00100
00101
00102
00103 typedef typename PolyMesh::VertexHandle VertexHandle;
00104 typedef typename PolyMesh::HalfedgeHandle HalfedgeHandle;
00105 typedef typename PolyMesh::EdgeHandle EdgeHandle;
00106 typedef typename PolyMesh::FaceHandle FaceHandle;
00107
00108
00109
00110
00111 typedef typename PolyMesh::VertexIter VertexIter;
00112 typedef typename PolyMesh::ConstVertexIter ConstVertexIter;
00113 typedef typename PolyMesh::EdgeIter EdgeIter;
00114 typedef typename PolyMesh::ConstEdgeIter ConstEdgeIter;
00115 typedef typename PolyMesh::FaceIter FaceIter;
00116 typedef typename PolyMesh::ConstFaceIter ConstFaceIter;
00117
00118
00119
00120
00121
00122 typedef typename PolyMesh::VertexVertexIter VertexVertexIter;
00123 typedef typename PolyMesh::VertexOHalfedgeIter VertexOHalfedgeIter;
00124 typedef typename PolyMesh::VertexIHalfedgeIter VertexIHalfedgeIter;
00125 typedef typename PolyMesh::VertexEdgeIter VertexEdgeIter;
00126 typedef typename PolyMesh::VertexFaceIter VertexFaceIter;
00127 typedef typename PolyMesh::FaceVertexIter FaceVertexIter;
00128 typedef typename PolyMesh::FaceHalfedgeIter FaceHalfedgeIter;
00129 typedef typename PolyMesh::FaceEdgeIter FaceEdgeIter;
00130 typedef typename PolyMesh::FaceFaceIter FaceFaceIter;
00131 typedef typename PolyMesh::ConstVertexVertexIter ConstVertexVertexIter;
00132 typedef typename PolyMesh::ConstVertexOHalfedgeIter ConstVertexOHalfedgeIter;
00133 typedef typename PolyMesh::ConstVertexIHalfedgeIter ConstVertexIHalfedgeIter;
00134 typedef typename PolyMesh::ConstVertexEdgeIter ConstVertexEdgeIter;
00135 typedef typename PolyMesh::ConstVertexFaceIter ConstVertexFaceIter;
00136 typedef typename PolyMesh::ConstFaceVertexIter ConstFaceVertexIter;
00137 typedef typename PolyMesh::ConstFaceHalfedgeIter ConstFaceHalfedgeIter;
00138 typedef typename PolyMesh::ConstFaceEdgeIter ConstFaceEdgeIter;
00139 typedef typename PolyMesh::ConstFaceFaceIter ConstFaceFaceIter;
00140
00141
00142
00143
00144
00145
00146
00147
00149 TriMeshT() : PolyMesh() {}
00150
00152 ~TriMeshT() {}
00153
00155 TriMeshT& operator=(const TriMeshT& _rhs)
00156 { PolyMesh::operator=(_rhs); return *this; }
00157
00158
00159
00160
00161
00162
00163
00167
00172 FaceHandle add_face(const std::vector<VertexHandle>& _vhandles);
00173
00177 FaceHandle add_face(VertexHandle _v0, VertexHandle _v1, VertexHandle _v2) {
00178 static std::vector<VertexHandle> vhandles(3);
00179 vhandles[0] = _v0; vhandles[1] = _v1; vhandles[2] = _v2;
00180 return PolyMesh::add_face(vhandles);
00181 }
00182
00186 template <class OtherMesh>
00187 TriMeshT& assign(const OtherMesh& _rhs)
00188 #if OM_OUT_OF_CLASS_TEMPLATE || defined(DOXYGEN)
00189 ;
00190 #else
00191 # include "PolyMeshT_assign.hh"
00192 #endif
00193
00195
00196
00201 VertexHandle opposite_vh(HalfedgeHandle _heh) const
00202 {
00203 if (is_boundary(_heh))
00204 {
00205 return InvalidVertexHandle;
00206 }
00207 return to_vertex_handle(next_halfedge_handle(_heh));
00208 }
00209
00214 VertexHandle opposite_he_opposite_vh(HalfedgeHandle _heh) const
00215 {
00216 return opposite_vh(opposite_halfedge_handle(_heh));
00217 }
00218
00219
00220
00221
00222
00226
00239 void collapse(HalfedgeHandle _heh);
00240
00241
00242
00248 bool is_collapse_ok(HalfedgeHandle _heh);
00249
00250
00252 HalfedgeHandle vertex_split( Point _v0_point,
00253 VertexHandle _v1,
00254 VertexHandle _vl,
00255 VertexHandle _vr )
00256 { return vertex_split(add_vertex(_v0_point), _v1, _vl, _vr); }
00257
00258
00260 HalfedgeHandle vertex_split( VertexHandle v0,
00261 VertexHandle v1,
00262 VertexHandle vl,
00263 VertexHandle vr );
00264
00265
00267 bool is_flip_ok(EdgeHandle _eh) const;
00268
00271 void flip(EdgeHandle _eh);
00272
00274 void split(EdgeHandle _eh, VertexHandle _vh);
00276 void split(EdgeHandle _eh, const Point& _p) {
00277 split(_eh, add_vertex(_p));
00278 }
00279
00281 void split(FaceHandle _fh, VertexHandle _vh) {
00282 PolyMeshT<Kernel>::split(_fh, _vh);
00283 }
00285 void split(FaceHandle _fh, const Point& _p) {
00286 PolyMeshT<Kernel>::split(_fh, _p);
00287 }
00288
00290
00291
00292 private:
00293
00295 void remove_edge(HalfedgeHandle _hh);
00296
00298 void remove_loop(HalfedgeHandle _hh);
00299
00301 HalfedgeHandle insert_loop(HalfedgeHandle _hh);
00302
00304 HalfedgeHandle insert_edge(VertexHandle _vh,
00305 HalfedgeHandle _h0,
00306 HalfedgeHandle _h1);
00307 };
00308
00309
00310
00311 }
00312
00313 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_TRIMESH_C)
00314 #define OPENMESH_TRIMESH_TEMPLATES
00315 #include "TriMeshT.cc"
00316 #endif
00317
00318 #endif // OPENMESH_TRIMESH_HH defined
00319