OpenMesh

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TriMeshT.hh
1 /*===========================================================================*\
2 * *
3 * OpenMesh *
4 * Copyright (C) 2001-2014 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: 990 $ *
38 * $Date: 2014-02-05 10:01:07 +0100 (Mi, 05. Feb 2014) $ *
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 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 //=============================================================================
OpenMesh::EdgeHandle
Handle for a edge entity.
Definition: Handles.hh:128
OpenMesh::PolyMeshT::FaceEdgeIter
Kernel::FaceEdgeIter FaceEdgeIter
Circulator.
Definition: PolyMeshT.hh:165
OpenMesh::TriMeshT::split
void split(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
Definition: TriMeshT.hh:336
OpenMesh::PolyMeshT
Base type for a polygonal mesh.
Definition: PolyMeshT.hh:87
OpenMesh::PolyMeshT::ConstVertexFaceIter
Kernel::ConstVertexFaceIter ConstVertexFaceIter
Circulator.
Definition: PolyMeshT.hh:172
OpenMesh::PolyMeshT::split
void split(FaceHandle _fh, const Point &_p)
Face split (= 1-to-n split)
Definition: PolyMeshT.hh:504
OpenMesh::PolyMeshT::Halfedge
Kernel::Halfedge Halfedge
Halfedge type.
Definition: PolyMeshT.hh:122
OpenMesh::TriMeshT::vertex_split
HalfedgeHandle vertex_split(Point _v0_point, VertexHandle _v1, VertexHandle _vl, VertexHandle _vr)
Vertex Split: inverse operation to collapse().
Definition: TriMeshT.hh:206
OpenMesh::TriMeshT::TriMeshT
TriMeshT()
Default constructor.
Definition: TriMeshT.hh:164
OpenMesh::PolyMeshT::VertexFaceIter
Kernel::VertexFaceIter VertexFaceIter
Circulator.
Definition: PolyMeshT.hh:162
OpenMesh::PolyMeshT::TexCoord2D
Kernel::TexCoord2D TexCoord2D
TexCoord2D type.
Definition: PolyMeshT.hh:116
OpenMesh::PolyMeshT::ConstVertexEdgeIter
Kernel::ConstVertexEdgeIter ConstVertexEdgeIter
Circulator.
Definition: PolyMeshT.hh:171
OpenMesh::PolyMeshT::Scalar
Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:106
OpenMesh::TriMeshT::split_copy
void split_copy(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriMeshT.hh:299
OpenMesh::TriMeshT::calc_face_normal
Normal calc_face_normal(FaceHandle _fh) const
Calculate normal vector for face _fh (specialized for TriMesh).
Definition: TriMeshT.cc:72
OpenMesh::FaceHandle
Handle for a face entity.
Definition: Handles.hh:135
OpenMesh::VertexHandle
Handle for a vertex entity.
Definition: Handles.hh:114
OpenMesh::TriMeshT
Base type for a triangle mesh.
Definition: TriMeshT.hh:88
OpenMesh::PolyMeshT::Face
Kernel::Face Face
Face type.
Definition: PolyMeshT.hh:126
OpenMesh::TriMeshT::split_copy
void split_copy(FaceHandle _fh, VertexHandle _vh)
Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
Definition: TriMeshT.hh:346
OpenMesh::TriMeshT::split_copy
VertexHandle split_copy(FaceHandle _fh, const Point &_p)
Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
Definition: TriMeshT.hh:326
OpenMesh::PolyMeshT::ConstVertexIHalfedgeIter
Kernel::ConstVertexIHalfedgeIter ConstVertexIHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:170
OpenMesh::PolyMeshT::VertexHandle
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:132
OpenMesh::PolyMeshT::Normal
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:110
OpenMesh::PolyMeshT::Color
Kernel::Color Color
Color type.
Definition: PolyMeshT.hh:112
OpenMesh::PolyMeshT::VertexOHalfedgeIter
Kernel::VertexOHalfedgeIter VertexOHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:159
OpenMesh::TriMeshT::split_copy
VertexHandle split_copy(EdgeHandle _eh, const Point &_p)
Edge split (= 2-to-4 split)
Definition: TriMeshT.hh:273
OpenMesh::PolyMeshT::FaceFaceIter
Kernel::FaceFaceIter FaceFaceIter
Circulator.
Definition: PolyMeshT.hh:166
OpenMesh::PolyMeshT::VertexIHalfedgeIter
Kernel::VertexIHalfedgeIter VertexIHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:160
OpenMesh::PolyMeshT::FaceVertexIter
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:163
OpenMesh::TriMeshT::is_polymesh
static bool is_polymesh()
Determine whether this is a PolyMeshT or TriMeshT ( This function does not check the per face vertex ...
Definition: TriMeshT.hh:102
OpenMesh::PolyMeshT::ConstFaceFaceIter
Kernel::ConstFaceFaceIter ConstFaceFaceIter
Circulator.
Definition: PolyMeshT.hh:176
OpenMesh::TriMeshT::vertex_split
HalfedgeHandle vertex_split(VertexHandle _v0, VertexHandle _v1, VertexHandle _vl, VertexHandle _vr)
Vertex Split: inverse operation to collapse().
Definition: TriMeshT.hh:246
OpenMesh::PolyMeshT::TexCoord1D
Kernel::TexCoord1D TexCoord1D
TexCoord1D type.
Definition: PolyMeshT.hh:114
OpenMesh::PolyMeshT::ConstFaceVertexIter
Kernel::ConstFaceVertexIter ConstFaceVertexIter
Circulator.
Definition: PolyMeshT.hh:173
OpenMesh::TriMeshT::split
VertexHandle split(EdgeHandle _eh, const Point &_p)
Edge split (= 2-to-4 split)
Definition: TriMeshT.hh:259
OpenMesh::PolyMeshT::Vertex
Kernel::Vertex Vertex
Vertex type.
Definition: PolyMeshT.hh:120
OpenMesh::PolyMeshT::Edge
Kernel::Edge Edge
Edge type.
Definition: PolyMeshT.hh:124
OpenMesh::TriMeshT::~TriMeshT
virtual ~TriMeshT()
Destructor.
Definition: TriMeshT.hh:166
OpenMesh::PolyMeshT::TexCoord3D
Kernel::TexCoord3D TexCoord3D
TexCoord3D type.
Definition: PolyMeshT.hh:118
OpenMesh::PolyMeshT::Point
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:108
OpenMesh::PolyMeshT::ConstFaceEdgeIter
Kernel::ConstFaceEdgeIter ConstFaceEdgeIter
Circulator.
Definition: PolyMeshT.hh:175
OpenMesh::PolyMeshT::VertexEdgeIter
Kernel::VertexEdgeIter VertexEdgeIter
Circulator.
Definition: PolyMeshT.hh:161
OpenMesh::PolyMeshT::FaceHalfedgeIter
Kernel::FaceHalfedgeIter FaceHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:164
OpenMesh::PolyMeshT::ConstVertexVertexIter
Kernel::ConstVertexVertexIter ConstVertexVertexIter
Circulator.
Definition: PolyMeshT.hh:168
OpenMesh::HalfedgeHandle
Handle for a halfedge entity.
Definition: Handles.hh:121
OpenMesh::PolyMeshT::VertexVertexIter
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Definition: PolyMeshT.hh:158
OpenMesh::TriMeshT::split
void split(EdgeHandle _eh, VertexHandle _vh)
Edge split (= 2-to-4 split)
Definition: TriMeshT.hh:286
OpenMesh::PolyMeshT::ConstVertexOHalfedgeIter
Kernel::ConstVertexOHalfedgeIter ConstVertexOHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:169
OpenMesh::TriMeshT::split
VertexHandle split(FaceHandle _fh, const Point &_p)
Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
Definition: TriMeshT.hh:314
OpenMesh::TriMeshT::is_trimesh
static bool is_trimesh()
Determine whether this is a PolyMeshT or TriMeshT ( This function does not check the per face vertex ...
Definition: TriMeshT.hh:103
OpenMesh::PolyMeshT::ConstFaceHalfedgeIter
Kernel::ConstFaceHalfedgeIter ConstFaceHalfedgeIter
Circulator.
Definition: PolyMeshT.hh:174