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
CompositeT.hh
Go to the documentation of this file.
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
46 //=============================================================================
47 //
48 // CLASS CompositeT
49 //
50 //=============================================================================
51
52 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
53 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
54
55
56 //== INCLUDES =================================================================
57
58 #include <string>
59 #include <vector>
60 // --------------------
61 #include <OpenMesh/Tools/Subdivider/Uniform/SubdividerT.hh>
62
63 //== NAMESPACE ================================================================
64
65 namespace OpenMesh { // BEGIN_NS_OPENMESH
66 namespace Subdivider { // BEGIN_NS_DECIMATER
67 namespace Uniform { // BEGIN_NS_UNIFORM
68
69
70 //== CLASS DEFINITION =========================================================
71
86 template <typename MeshType, typename RealType=float >
87 class CompositeT : public SubdividerT< MeshType, RealType >
88 {
89 public:
90
91 typedef RealType real_t;
92 typedef MeshType mesh_t;
93 typedef SubdividerT< mesh_t, real_t > parent_t;
94
95 public:
96
97 CompositeT(void) : parent_t(), p_mesh_(NULL) {}
98 CompositeT(MeshType& _mesh) : parent_t(_mesh), p_mesh_(NULL) {};
99 virtual ~CompositeT() { }
100
101 public: // inherited interface
102
103 virtual const char *name( void ) const = 0;
104
105 protected: // inherited interface
106
107 bool prepare( MeshType& _m );
108
109 bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true )
110 {
111 assert( p_mesh_ == &_m );
112
113 while(_n--)
114 {
115 apply_rules();
116 commit(_m);
117 }
118
119 return true;
120 }
121
122 #ifdef NDEBUG
123 bool cleanup( MeshType& )
124 #else
125 bool cleanup( MeshType& _m )
126 #endif
127 {
128 assert( p_mesh_ == &_m );
129 p_mesh_=NULL;
130 return true;
131 }
132
133 protected:
134
137 virtual void apply_rules(void) = 0;
138
139 protected:
140
143 void commit( MeshType &_m)
144 {
145 typename MeshType::VertexIter v_it;
146
147 for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
148 _m.set_point(*v_it, _m.data(*v_it).position());
149 }
150
151
152 public:
153
155 struct Coeff
156 {
157 virtual ~Coeff() { }
158 virtual double operator() (size_t _valence) = 0;
159 };
160
161
162 protected:
163
164 typedef typename MeshType::Scalar scalar_t;
165 typedef typename MeshType::VertexHandle VertexHandle;
166 typedef typename MeshType::FaceHandle FaceHandle;
167 typedef typename MeshType::EdgeHandle EdgeHandle;
168 typedef typename MeshType::HalfedgeHandle HalfedgeHandle;
169
171
172
173
174 void Tvv3();
175 void Tvv4();
176 void Tfv();
177
178 void FF();
179 void FFc(Coeff& _coeff);
180 void FFc(scalar_t _c);
181
182 void FV();
183 void FVc(Coeff& _coeff);
184 void FVc(scalar_t _c);
185
186 void FE();
187
188 void VF();
189 void VFa(Coeff& _coeff);
190 void VFa(scalar_t _alpha);
191
192 void VV();
193 void VVc(Coeff& _coeff);
194 void VVc(scalar_t _c);
195
196 void VE();
197
198
199 void VdE();
200 void VdEc(scalar_t _c);
201
204 void VdEg(Coeff& _coeff);
207 void VdEg(scalar_t _gamma);
208
209 void EF();
210
211 void EV();
212 void EVc(Coeff& _coeff);
213 void EVc(scalar_t _c);
214
215 void EdE();
216 void EdEc(scalar_t _c);
217
218
220
221 void corner_cutting(HalfedgeHandle _heh);
222
223 VertexHandle split_edge(HalfedgeHandle _heh);
224
225 private:
226
227 MeshType* p_mesh_;
228
229 };
230
231
232 //=============================================================================
233 } // END_NS_UNIFORM
234 } // END_NS_SUBDIVIDER
235 } // END_NS_OPENMESH
236 //=============================================================================
237 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_CC)
238 #define OPENMESH_SUBDIVIDER_TEMPLATES
239 #include "CompositeT.cc"
240 #endif
241 //=============================================================================
242 #endif // COMPOSITET_HH defined
243 //=============================================================================
244
OpenMesh::Subdivider::Uniform::CompositeT::VdEc
void VdEc(scalar_t _c)
Weighted vertex to edge averaging, using diamond of edges.
Definition: CompositeT.cc:680
OpenMesh::Subdivider::Uniform::CompositeT::FE
void FE()
Face to edge averaging.
Definition: CompositeT.cc:945
OpenMesh::Subdivider::Uniform::CompositeT::VF
void VF()
Vertex to Face Averaging.
Definition: CompositeT.cc:285
OpenMesh::Subdivider::Uniform::CompositeT::EF
void EF()
Edge to face averaging.
Definition: CompositeT.cc:921
OpenMesh::Subdivider::Uniform::CompositeT::Tfv
void Tfv()
Split Face, using Face Information.
Definition: CompositeT.cc:209
OpenMesh::Subdivider::Uniform::CompositeT::cleanup
bool cleanup(MeshType &_m)
Cleanup mesh after usage, e.g. remove added properties.
Definition: CompositeT.hh:125
OpenMesh::Subdivider::Uniform::CompositeT::commit
void commit(MeshType &_m)
Move vertices to new positions after the rules have been applied to the mesh (called by subdivide())...
Definition: CompositeT.hh:143
OpenMesh::Subdivider::Uniform::CompositeT::VdE
void VdE()
Vertex to edge averaging, using diamond of edges.
Definition: CompositeT.cc:644
OpenMesh::Subdivider::Uniform::CompositeT::prepare
bool prepare(MeshType &_m)
Prepare mesh, e.g. add properties.
Definition: CompositeT.cc:74
OpenMesh::Subdivider::Uniform::SubdividerT
Abstract base class for uniform subdivision algorithms.
Definition: SubdividerT.hh:87
OpenMesh::Subdivider::Uniform::CompositeT::name
virtual const char * name(void) const =0
Return name of subdivision algorithm.
OpenMesh::Subdivider::Uniform::CompositeT::FVc
void FVc(Coeff &_coeff)
Weighted face to vertex Averaging with flaps.
Definition: CompositeT.cc:557
OpenMesh::Subdivider::Uniform::CompositeT::FFc
void FFc(Coeff &_coeff)
Weighted face to face averaging.
Definition: CompositeT.cc:457
OpenMesh::Subdivider::Uniform::CompositeT::FF
void FF()
Face to face averaging.
Definition: CompositeT.cc:421
OpenMesh::Subdivider::Uniform::CompositeT::corner_cutting
void corner_cutting(HalfedgeHandle _heh)
Corner Cutting.
Definition: CompositeT.cc:1181
OpenMesh::Subdivider::Uniform::CompositeT::Tvv3
void Tvv3()
Split Face, using Vertex information (1-3 split)
Definition: CompositeT.cc:90
OpenMesh::Subdivider::Uniform::CompositeT::Coeff
Abstract base class for coefficient functions.
Definition: CompositeT.hh:155
OpenMesh::Subdivider::Uniform::CompositeT::EV
void EV()
Edge to vertex averaging.
Definition: CompositeT.cc:833
OpenMesh::Subdivider::Uniform::CompositeT::EdE
void EdE()
Edge to edge averaging w/ flap rule.
Definition: CompositeT.cc:1097
OpenMesh::Subdivider::Uniform::CompositeT::subdivide
bool subdivide(MeshType &_m, size_t _n, const bool _update_points=true)
Subdivide mesh _m _n times.
Definition: CompositeT.hh:109
OpenMesh::Subdivider::Uniform::CompositeT::split_edge
VertexHandle split_edge(HalfedgeHandle _heh)
Split Edge.
Definition: CompositeT.cc:1230
OpenMesh::Subdivider::Uniform::CompositeT::apply_rules
virtual void apply_rules(void)=0
Assemble here the rule sequence, by calling the constructor of the wanted rules.
OpenMesh::Subdivider::Uniform::CompositeT::EVc
void EVc(Coeff &_coeff)
Weighted edge to vertex averaging.
Definition: CompositeT.cc:859
OpenMesh::Subdivider::Uniform::CompositeT::EdEc
void EdEc(scalar_t _c)
Weighted edge to edge averaging w/ flap rule.
Definition: CompositeT.cc:1138
SubdividerT.hh
OpenMesh::Subdivider::Uniform::CompositeT::VE
void VE()
VE Step (Vertex to Edge Averaging)
Definition: CompositeT.cc:973
OpenMesh::Subdivider::Uniform::CompositeT
This class provides the composite subdivision rules for the uniform case.
Definition: CompositeT.hh:87
OpenMesh::Subdivider::Uniform::CompositeT::VFa
void VFa(Coeff &_coeff)
Vertex to Face Averaging, weighted.
Definition: CompositeT.cc:309
OpenMesh::Subdivider::Uniform::CompositeT::VdEg
void VdEg(Coeff &_coeff)
Weigthed vertex to edge averaging, using diamond of edges for irregular vertices. ...
Definition: CompositeT.cc:771
OpenMesh::Subdivider::Uniform::CompositeT::Tvv4
void Tvv4()
Split Face, using Vertex information (1-4 split)
Definition: CompositeT.cc:154
OpenMesh::Subdivider::Uniform::CompositeT::VVc
void VVc(Coeff &_coeff)
Vertex to vertex averaging, weighted.
Definition: CompositeT.cc:1025
OpenMesh::Subdivider::Uniform::CompositeT::FV
void FV()
Face to vertex averaging.
Definition: CompositeT.cc:532
OpenMesh::Subdivider::Uniform::CompositeT::VV
void VV()
Vertex to vertex averaging.
Definition: CompositeT.cc:991