OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TriMeshT.hh
1 /*===========================================================================*\
2 * *
3 * OpenMesh *
4 * Copyright (C) 2001-2012 by Computer Graphics Group, RWTH Aachen *
5 * www.openmesh.org *
6 * *
7 *---------------------------------------------------------------------------*
8 * This file is part of OpenMesh. *
9 * *
10 * OpenMesh is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenMesh is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenMesh. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34
35 /*===========================================================================*\
36 * *
37 * $Revision: 773 $ *
38 * $Date: 2012-11-30 08:16:24 +0100 (Fr, 30 Nov 2012) $ *
39 * *
40 \*===========================================================================*/
41
42
43 //=============================================================================
44 //
45 // CLASS TriMeshT
46 //
47 //=============================================================================
48
49
50 #ifndef OPENMESH_TRIMESH_HH
51 #define OPENMESH_TRIMESH_HH
52
53
54 //== INCLUDES =================================================================
55
56
57 #include <OpenMesh/Core/System/config.h>
58 #include <OpenMesh/Core/Mesh/PolyMeshT.hh>
59 #include <vector>
60
61
62 //== NAMESPACES ===============================================================
63
64
65 namespace OpenMesh {
66
67
68 //== CLASS DEFINITION =========================================================
69
70
87 template <class Kernel>
88 class TriMeshT : public PolyMeshT<Kernel>
89 {
90
91 public:
92
93
94 // self
95 typedef TriMeshT<Kernel> This;
96 typedef PolyMeshT<Kernel> PolyMesh;
97
99
100 enum { IsPolyMesh = 0 };
101 enum { IsTriMesh = 1 };
102 static bool is_polymesh() { return false; }
103 static bool is_trimesh() { return true; }
105
106 //--- items ---
107
108 typedef typename PolyMesh::Scalar Scalar;
109 typedef typename PolyMesh::Point Point;
110 typedef typename PolyMesh::Normal Normal;
111 typedef typename PolyMesh::Color Color;
112 typedef typename PolyMesh::TexCoord1D TexCoord1D;
113 typedef typename PolyMesh::TexCoord2D TexCoord2D;
114 typedef typename PolyMesh::TexCoord3D TexCoord3D;
115 typedef typename PolyMesh::Vertex Vertex;
116 typedef typename PolyMesh::Halfedge Halfedge;
117 typedef typename PolyMesh::Edge Edge;
118 typedef typename PolyMesh::Face Face;
119
120
121 //--- handles ---
122
123 typedef typename PolyMesh::VertexHandle VertexHandle;
124 typedef typename PolyMesh::HalfedgeHandle HalfedgeHandle;
125 typedef typename PolyMesh::EdgeHandle EdgeHandle;
126 typedef typename PolyMesh::FaceHandle FaceHandle;
127
128
129 //--- iterators ---
130
131 typedef typename PolyMesh::VertexIter VertexIter;
132 typedef typename PolyMesh::ConstVertexIter ConstVertexIter;
133 typedef typename PolyMesh::EdgeIter EdgeIter;
134 typedef typename PolyMesh::ConstEdgeIter ConstEdgeIter;
135 typedef typename PolyMesh::FaceIter FaceIter;
136 typedef typename PolyMesh::ConstFaceIter ConstFaceIter;
137
138
139
140 //--- circulators ---
141
142 typedef typename PolyMesh::VertexVertexIter VertexVertexIter;
143 typedef typename PolyMesh::VertexOHalfedgeIter VertexOHalfedgeIter;
144 typedef typename PolyMesh::VertexIHalfedgeIter VertexIHalfedgeIter;
145 typedef typename PolyMesh::VertexEdgeIter VertexEdgeIter;
146 typedef typename PolyMesh::VertexFaceIter VertexFaceIter;
147 typedef typename PolyMesh::FaceVertexIter FaceVertexIter;
148 typedef typename PolyMesh::FaceHalfedgeIter FaceHalfedgeIter;
149 typedef typename PolyMesh::FaceEdgeIter FaceEdgeIter;
150 typedef typename PolyMesh::FaceFaceIter FaceFaceIter;
151 typedef typename PolyMesh::ConstVertexVertexIter ConstVertexVertexIter;
152 typedef typename PolyMesh::ConstVertexOHalfedgeIter ConstVertexOHalfedgeIter;
153 typedef typename PolyMesh::ConstVertexIHalfedgeIter ConstVertexIHalfedgeIter;
154 typedef typename PolyMesh::ConstVertexEdgeIter ConstVertexEdgeIter;
155 typedef typename PolyMesh::ConstVertexFaceIter ConstVertexFaceIter;
156 typedef typename PolyMesh::ConstFaceVertexIter ConstFaceVertexIter;
157 typedef typename PolyMesh::ConstFaceHalfedgeIter ConstFaceHalfedgeIter;
158 typedef typename PolyMesh::ConstFaceEdgeIter ConstFaceEdgeIter;
159 typedef typename PolyMesh::ConstFaceFaceIter ConstFaceFaceIter;
160
161 // --- constructor/destructor
162
164 TriMeshT() : PolyMesh() {}
166 virtual ~TriMeshT() {}
167
168 //--- halfedge collapse / vertex split ---
169
206 inline HalfedgeHandle vertex_split(Point _v0_point, VertexHandle _v1,
207 VertexHandle _vl, VertexHandle _vr)
208 { return PolyMesh::vertex_split(add_vertex(_v0_point), _v1, _vl, _vr); }
209
246 inline HalfedgeHandle vertex_split(VertexHandle _v0, VertexHandle _v1,
247 VertexHandle _vl, VertexHandle _vr)
248 { return PolyMesh::vertex_split(_v0, _v1, _vl, _vr); }
249
259 inline VertexHandle split(EdgeHandle _eh, const Point& _p)
260 {
261 //Do not call PolyMeshT function below as this does the wrong operation
262 const VertexHandle vh = this->add_vertex(_p); Kernel::split(_eh, vh); return vh;
263 }
264
273 inline VertexHandle split_copy(EdgeHandle _eh, const Point& _p)
274 {
275 //Do not call PolyMeshT function below as this does the wrong operation
276 const VertexHandle vh = this->add_vertex(_p); Kernel::split_copy(_eh, vh); return vh;
277 }
278
286 inline void split(EdgeHandle _eh, VertexHandle _vh)
287 {
288 //Do not call PolyMeshT function below as this does the wrong operation
289 Kernel::split(_eh, _vh);
290 }
291
299 inline void split_copy(EdgeHandle _eh, VertexHandle _vh)
300 {
301 //Do not call PolyMeshT function below as this does the wrong operation
302 Kernel::split_copy(_eh, _vh);
303 }
304
314 inline VertexHandle split(FaceHandle _fh, const Point& _p)
315 { const VertexHandle vh = this->add_vertex(_p); PolyMesh::split(_fh, vh); return vh; }
316
326 inline VertexHandle split_copy(FaceHandle _fh, const Point& _p)
327 { const VertexHandle vh = this->add_vertex(_p); PolyMesh::split_copy(_fh, vh); return vh; }
328
336 inline void split(FaceHandle _fh, VertexHandle _vh)
337 { PolyMesh::split(_fh, _vh); }
338
346 inline void split_copy(FaceHandle _fh, VertexHandle _vh)
347 { PolyMesh::split_copy(_fh, _vh); }
348
352
354 Normal calc_face_normal(FaceHandle _fh) const;
355
357 };
358
359
360 //=============================================================================
361 } // namespace OpenMesh
362 //=============================================================================
363 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_TRIMESH_C)
364 #define OPENMESH_TRIMESH_TEMPLATES
365 #include "TriMeshT.cc"
366 #endif
367 //=============================================================================
368 #endif // OPENMESH_TRIMESH_HH defined
369 //=============================================================================