OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RulesT.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 
47 //=============================================================================
48 //
49 // Composite Subdivision and Averaging Rules
50 //
51 //=============================================================================
52 
53 #ifndef OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
54 #define OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
55 
56 
57 //== INCLUDES =================================================================
58 
59 #include <OpenMesh/Core/System/config.hh>
60 #include <OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh>
61 // -------------------- STL
62 #include <vector>
63 
64 
65 #if defined(OM_CC_MIPS) // avoid warnings
66 # define MIPS_WARN_WA( Item ) \
67  void raise(typename M:: ## Item ## Handle &_h, state_t _target_state ) \
68  { Inherited::raise(_h, _target_state); }
69 #else
70 # define MIPS_WARN_WA( Item )
71 #endif
72 
73 //== NAMESPACE ================================================================
74 
75 namespace OpenMesh { // BEGIN_NS_OPENMESH
76 namespace Subdivider { // BEGIN_NS_SUBDIVIDER
77 namespace Adaptive { // BEGIN_NS_ADAPTIVE
78 
79 
80 //== CLASS DEFINITION =========================================================
81 
86 //=============================================================================
87 
90 template <class M> class Tvv3 : public RuleInterfaceT<M>
91 {
92  COMPOSITE_RULE( Tvv3, M );
93 private:
94  typedef RuleInterfaceT<M> Base;
95 
96 public:
97 
99 
100  Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); };
101 
102  void raise(typename M::FaceHandle& _fh, state_t _target_state);
103  void raise(typename M::VertexHandle& _vh, state_t _target_state);
104  MIPS_WARN_WA(Edge) // avoid warning
105 };
106 
107 
108 //=============================================================================
109 
110 
113 template <class M> class Tvv4 : public RuleInterfaceT<M>
114 {
115  COMPOSITE_RULE( Tvv4, M );
116 
117 private:
118  typedef RuleInterfaceT<M> Base;
119 public:
120  typedef typename M::HalfedgeHandle HEH;
121  typedef typename M::VertexHandle VH;
122 
124 
125  Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); };
126 
127  void raise(typename M::FaceHandle& _fh, state_t _target_state);
128  void raise(typename M::VertexHandle& _vh, state_t _target_state);
129  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
130 
131 private:
132 
133  void split_edge(HEH& _hh, VH& _vh, state_t _target_state);
134  void check_edge(const typename M::HalfedgeHandle& _hh,
135  state_t _target_state);
136 };
137 
138 
139 //=============================================================================
140 
141 
144 template <class M> class VF : public RuleInterfaceT<M>
145 {
146  COMPOSITE_RULE( VF, M );
147 private:
148  typedef RuleInterfaceT<M> Base;
149 
150 public:
152 
153  VF(M& _mesh) : Inherited(_mesh) {}
154 
155  void raise(typename M::FaceHandle& _fh, state_t _target_state);
156  MIPS_WARN_WA(Edge)
157  MIPS_WARN_WA(Vertex)
158 };
159 
160 
161 //=============================================================================
162 
163 
166 template <class M> class FF : public RuleInterfaceT<M>
167 {
168  COMPOSITE_RULE( FF, M );
169 private:
170  typedef RuleInterfaceT<M> Base;
171 
172 public:
173  typedef RuleInterfaceT<M> Inherited;
174 
175  FF(M& _mesh) : Inherited(_mesh) {}
176 
177  void raise(typename M::FaceHandle& _fh, state_t _target_state);
178  MIPS_WARN_WA(Vertex) // avoid warning
179  MIPS_WARN_WA(Edge ) // avoid warning
180 };
181 
182 
183 //=============================================================================
184 
185 
188 template <class M> class FFc : public RuleInterfaceT<M>
189 {
190  COMPOSITE_RULE( FFc, M );
191 private:
192  typedef RuleInterfaceT<M> Base;
193 
194 public:
195  typedef RuleInterfaceT<M> Inherited;
196 
197  FFc(M& _mesh) : Inherited(_mesh) {}
198 
199  void raise(typename M::FaceHandle& _fh, state_t _target_state);
200  MIPS_WARN_WA(Vertex) // avoid warning
201  MIPS_WARN_WA(Edge ) // avoid warning
202 };
203 
204 
205 //=============================================================================
206 
207 
210 template <class M> class FV : public RuleInterfaceT<M>
211 {
212  COMPOSITE_RULE( FV, M );
213 private:
214  typedef RuleInterfaceT<M> Base;
215 
216 public:
217  typedef RuleInterfaceT<M> Inherited;
218 
219  FV(M& _mesh) : Inherited(_mesh) {}
220 
221  void raise(typename M::VertexHandle& _vh, state_t _target_state);
222  MIPS_WARN_WA(Face) // avoid warning
223  MIPS_WARN_WA(Edge) // avoid warning
224 };
225 
226 
227 //=============================================================================
228 
229 
232 template <class M> class FVc : public RuleInterfaceT<M>
233 {
234  COMPOSITE_RULE( FVc, M );
235 private:
236  typedef RuleInterfaceT<M> Base;
237 
238 public:
239  typedef RuleInterfaceT<M> Inherited;
240 
241  FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
242 
243  void raise(typename M::VertexHandle& _vh, state_t _target_state);
244  MIPS_WARN_WA(Face) // avoid warning
245  MIPS_WARN_WA(Edge) // avoid warning
246 
247  static void init_coeffs(size_t _max_valence);
248  static const std::vector<double>& coeffs() { return coeffs_; }
249 
250  double coeff( size_t _valence )
251  {
252  assert(_valence < coeffs_.size());
253  return coeffs_[_valence];
254  }
255 
256 private:
257 
258  static std::vector<double> coeffs_;
259 
260 };
261 
262 
263 //=============================================================================
264 
265 
268 template <class M> class VV : public RuleInterfaceT<M>
269 {
270  COMPOSITE_RULE( VV, M );
271 private:
272  typedef RuleInterfaceT<M> Base;
273 
274 public:
275 
276  typedef RuleInterfaceT<M> Inherited;
277 
278  VV(M& _mesh) : Inherited(_mesh) {}
279 
280  void raise(typename M::VertexHandle& _vh, state_t _target_state);
281  MIPS_WARN_WA(Face) // avoid warning
282  MIPS_WARN_WA(Edge) // avoid warning
283 };
284 
285 
286 //=============================================================================
287 
288 
291 template <class M> class VVc : public RuleInterfaceT<M>
292 {
293  COMPOSITE_RULE( VVc, M );
294 private:
295  typedef RuleInterfaceT<M> Base;
296 
297 public:
298  typedef RuleInterfaceT<M> Inherited;
299 
300  VVc(M& _mesh) : Inherited(_mesh) {}
301 
302  void raise(typename M::VertexHandle& _vh, state_t _target_state);
303  MIPS_WARN_WA(Face) // avoid warning
304  MIPS_WARN_WA(Edge) // avoid warning
305 };
306 
307 
308 //=============================================================================
309 
310 
313 template <class M> class VE : public RuleInterfaceT<M>
314 {
315  COMPOSITE_RULE( VE, M );
316 private:
317  typedef RuleInterfaceT<M> Base;
318 
319 public:
320  typedef RuleInterfaceT<M> Inherited;
321 
322  VE(M& _mesh) : Inherited(_mesh) {}
323 
324  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
325  MIPS_WARN_WA(Face ) // avoid warning
326  MIPS_WARN_WA(Vertex) // avoid warning
327 };
328 
329 
330 //=============================================================================
331 
332 
335 template <class M> class VdE : public RuleInterfaceT<M>
336 {
337  COMPOSITE_RULE( VdE, M );
338 private:
339  typedef RuleInterfaceT<M> Base;
340 
341 public:
342  typedef RuleInterfaceT<M> Inherited;
343 
344  VdE(M& _mesh) : Inherited(_mesh) {}
345 
346  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
347  MIPS_WARN_WA(Face ) // avoid warning
348  MIPS_WARN_WA(Vertex) // avoid warning
349 };
350 
351 
352 //=============================================================================
353 
354 
357 template <class M> class VdEc : public RuleInterfaceT<M>
358 {
359  COMPOSITE_RULE( VdEc, M );
360 private:
361  typedef RuleInterfaceT<M> Base;
362 
363 public:
364  typedef RuleInterfaceT<M> Inherited;
365 
366  VdEc(M& _mesh) : Inherited(_mesh) {}
367 
368  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
369  MIPS_WARN_WA(Face ) // avoid warning
370  MIPS_WARN_WA(Vertex) // avoid warning
371 };
372 
373 
374 //=============================================================================
375 
376 
379 template <class M> class EV : public RuleInterfaceT<M>
380 {
381  COMPOSITE_RULE( EV, M );
382 private:
383  typedef RuleInterfaceT<M> Base;
384 
385 public:
386  typedef RuleInterfaceT<M> Inherited;
387 
388  EV(M& _mesh) : Inherited(_mesh) {}
389 
390  void raise(typename M::VertexHandle& _vh, state_t _target_state);
391  MIPS_WARN_WA(Face) // avoid warning
392  MIPS_WARN_WA(Edge) // avoid warning
393 };
394 
395 
396 //=============================================================================
397 
398 
401 template <class M> class EVc : public RuleInterfaceT<M>
402 {
403  COMPOSITE_RULE( EVc, M );
404 private:
405  typedef RuleInterfaceT<M> Base;
406 
407 public:
408 
409  typedef RuleInterfaceT<M> Inherited;
410 
411  EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
412 
413  void raise(typename M::VertexHandle& _vh, state_t _target_state);
414  MIPS_WARN_WA(Face) // avoid warning
415  MIPS_WARN_WA(Edge) // avoid warning
416 
417  static void init_coeffs(size_t _max_valence);
418  static const std::vector<double>& coeffs() { return coeffs_; }
419 
420  double coeff( size_t _valence )
421  {
422  assert(_valence < coeffs_.size());
423  return coeffs_[_valence];
424  }
425 
426 private:
427 
428  static std::vector<double> coeffs_;
429 
430 };
431 
432 
433 //=============================================================================
434 
435 
438 template <class M> class EF : public RuleInterfaceT<M>
439 {
440  COMPOSITE_RULE( EF, M );
441 private:
442  typedef RuleInterfaceT<M> Base;
443 
444 public:
445  typedef RuleInterfaceT<M> Inherited;
446 
447  EF(M& _mesh) : Inherited(_mesh) {}
448 
449  void raise(typename M::FaceHandle& _fh, state_t _target_state);
450  MIPS_WARN_WA(Edge ) // avoid warning
451  MIPS_WARN_WA(Vertex) // avoid warning
452 };
453 
454 
455 //=============================================================================
456 
457 
460 template <class M> class FE : public RuleInterfaceT<M>
461 {
462  COMPOSITE_RULE( FE, M );
463 private:
464  typedef RuleInterfaceT<M> Base;
465 
466 public:
467  typedef RuleInterfaceT<M> Inherited;
468 
469  FE(M& _mesh) : Inherited(_mesh) {}
470 
471  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
472  MIPS_WARN_WA(Face ) // avoid warning
473  MIPS_WARN_WA(Vertex) // avoid warning
474 };
475 
476 
477 //=============================================================================
478 
479 
482 template <class M> class EdE : public RuleInterfaceT<M>
483 {
484  COMPOSITE_RULE( EdE, M );
485 private:
486  typedef RuleInterfaceT<M> Base;
487 
488 public:
489  typedef RuleInterfaceT<M> Inherited;
490 
491  EdE(M& _mesh) : Inherited(_mesh) {}
492 
493  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
494  MIPS_WARN_WA(Face ) // avoid warning
495  MIPS_WARN_WA(Vertex) // avoid warning
496 };
497 
498 
499 //=============================================================================
500 
501 
504 template <class M> class EdEc : public RuleInterfaceT<M>
505 {
506  COMPOSITE_RULE( EdEc, M );
507 private:
508  typedef RuleInterfaceT<M> Base;
509 
510 public:
511  typedef RuleInterfaceT<M> Inherited;
512 
513  EdEc(M& _mesh) : Inherited(_mesh) {}
514 
515  void raise(typename M::EdgeHandle& _eh, state_t _target_state);
516  MIPS_WARN_WA(Face ) // avoid warning
517  MIPS_WARN_WA(Vertex) // avoid warning
518 };
519 
520 // ----------------------------------------------------------------------------
521 
522 #undef MIPS_WARN_WA
523 
524 //=============================================================================
525 } // END_NS_ADAPTIVE
526 } // END_NS_SUBDIVIDER
527 } // END_NS_OPENMESH
528 //=============================================================================
529 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_CC)
530 # define OPENMESH_SUBDIVIDER_TEMPLATES
531 # include "RulesT.cc"
532 #endif
533 //=============================================================================
534 #endif // OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH defined
535 //=============================================================================
536 
Composite rule EdE.
Definition: RulesT.hh:482
Composite rule VVc.
Definition: RulesT.hh:291
Base class for adaptive composite subdivision rules.
Definition: CompositeT.hh:77
Composite rule FFc.
Definition: RulesT.hh:188
Adaptive Composite Subdivision framework.
Definition: RulesT.hh:90
Composite rule EV.
Definition: RulesT.hh:379
Composite rule FV.
Definition: RulesT.hh:210
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
Composite rule VdEc.
Definition: RulesT.hh:357
STL namespace.
CompositeTraits::state_t state_t
Adaptive Composite Subdivision framework.
Definition: CompositeTraits.hh:248
Composite rule VV.
Definition: RulesT.hh:268
Composite rule VF.
Definition: RulesT.hh:144
Composite rule FF.
Definition: RulesT.hh:166
Composite rule VdE.
Definition: RulesT.hh:335
Composite rule EdEc.
Definition: RulesT.hh:504
Composite rule VE.
Definition: RulesT.hh:313
Composite rule FE.
Definition: RulesT.hh:460
Composite rule EF.
Definition: RulesT.hh:438
Topological composite rule Tvv,4 doing a 1-4 split of a face.
Definition: RulesT.hh:113
Composite rule FVc.
Definition: RulesT.hh:232
scalar_t coeff() const
Get coefficient - ignored by non-parameterized rules.
Definition: RuleInterfaceT.hh:349
Composite rule EVc.
Definition: RulesT.hh:401

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .