OpenMesh
Loading...
Searching...
No Matches
RulesT.hh
Go to the documentation of this file.
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42/*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $Date$ *
46 * *
47\*===========================================================================*/
48
54//=============================================================================
55//
56// Composite Subdivision and Averaging Rules
57//
58//=============================================================================
59
60#ifndef OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
61#define OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
62
63
64//== INCLUDES =================================================================
65
66#include <OpenMesh/Core/System/config.hh>
67#include <OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh>
68// -------------------- STL
69#include <vector>
70
71
72#if defined(OM_CC_MIPS) // avoid warnings
73# define MIPS_WARN_WA( Item ) \
74 void raise(typename M:: ## Item ## Handle &_h, state_t _target_state ) \
75 { Inherited::raise(_h, _target_state); }
76#else
77# define MIPS_WARN_WA( Item )
78#endif
79
80//== NAMESPACE ================================================================
81
82namespace OpenMesh { // BEGIN_NS_OPENMESH
83namespace Subdivider { // BEGIN_NS_SUBDIVIDER
84namespace Adaptive { // BEGIN_NS_ADAPTIVE
85
86
87//== CLASS DEFINITION =========================================================
88
93//=============================================================================
94
97template <class M> class Tvv3 : public RuleInterfaceT<M>
98{
99 COMPOSITE_RULE( Tvv3, M );
100private:
101 typedef RuleInterfaceT<M> Base;
102
103public:
104
106
107 Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); };
108
109 void raise(typename M::FaceHandle& _fh, state_t _target_state);
110 void raise(typename M::VertexHandle& _vh, state_t _target_state);
111 MIPS_WARN_WA(Edge) // avoid warning
112};
113
114
115//=============================================================================
116
117
120template <class M> class Tvv4 : public RuleInterfaceT<M>
121{
122 COMPOSITE_RULE( Tvv4, M );
123
124private:
125 typedef RuleInterfaceT<M> Base;
126public:
127 typedef typename M::HalfedgeHandle HEH;
128 typedef typename M::VertexHandle VH;
129
131
132 Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); };
133
134 void raise(typename M::FaceHandle& _fh, state_t _target_state);
135 void raise(typename M::VertexHandle& _vh, state_t _target_state);
136 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
137
138private:
139
140 void split_edge(HEH& _hh, VH& _vh, state_t _target_state);
141 void check_edge(const typename M::HalfedgeHandle& _hh,
142 state_t _target_state);
143};
144
145
146//=============================================================================
147
148
151template <class M> class VF : public RuleInterfaceT<M>
152{
153 COMPOSITE_RULE( VF, M );
154private:
155 typedef RuleInterfaceT<M> Base;
156
157public:
159
160 VF(M& _mesh) : Inherited(_mesh) {}
161
162 void raise(typename M::FaceHandle& _fh, state_t _target_state);
163 MIPS_WARN_WA(Edge)
164 MIPS_WARN_WA(Vertex)
165};
166
167
168//=============================================================================
169
170
173template <class M> class FF : public RuleInterfaceT<M>
174{
175 COMPOSITE_RULE( FF, M );
176private:
177 typedef RuleInterfaceT<M> Base;
178
179public:
181
182 FF(M& _mesh) : Inherited(_mesh) {}
183
184 void raise(typename M::FaceHandle& _fh, state_t _target_state);
185 MIPS_WARN_WA(Vertex) // avoid warning
186 MIPS_WARN_WA(Edge ) // avoid warning
187};
188
189
190//=============================================================================
191
192
195template <class M> class FFc : public RuleInterfaceT<M>
196{
197 COMPOSITE_RULE( FFc, M );
198private:
199 typedef RuleInterfaceT<M> Base;
200
201public:
203
204 FFc(M& _mesh) : Inherited(_mesh) {}
205
206 void raise(typename M::FaceHandle& _fh, state_t _target_state);
207 MIPS_WARN_WA(Vertex) // avoid warning
208 MIPS_WARN_WA(Edge ) // avoid warning
209};
210
211
212//=============================================================================
213
214
217template <class M> class FV : public RuleInterfaceT<M>
218{
219 COMPOSITE_RULE( FV, M );
220private:
221 typedef RuleInterfaceT<M> Base;
222
223public:
225
226 FV(M& _mesh) : Inherited(_mesh) {}
227
228 void raise(typename M::VertexHandle& _vh, state_t _target_state);
229 MIPS_WARN_WA(Face) // avoid warning
230 MIPS_WARN_WA(Edge) // avoid warning
231};
232
233
234//=============================================================================
235
236
239template <class M> class FVc : public RuleInterfaceT<M>
240{
241 COMPOSITE_RULE( FVc, M );
242private:
243 typedef RuleInterfaceT<M> Base;
244
245public:
247
248 FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
249
250 void raise(typename M::VertexHandle& _vh, state_t _target_state);
251 MIPS_WARN_WA(Face) // avoid warning
252 MIPS_WARN_WA(Edge) // avoid warning
253
254 static void init_coeffs(size_t _max_valence);
255 static const std::vector<double>& coeffs() { return coeffs_; }
256
257 double coeff( size_t _valence )
258 {
259 assert(_valence < coeffs_.size());
260 return coeffs_[_valence];
261 }
262
263private:
264
265 static std::vector<double> coeffs_;
266
267};
268
269
270//=============================================================================
271
272
275template <class M> class VV : public RuleInterfaceT<M>
276{
277 COMPOSITE_RULE( VV, M );
278private:
279 typedef RuleInterfaceT<M> Base;
280
281public:
282
284
285 VV(M& _mesh) : Inherited(_mesh) {}
286
287 void raise(typename M::VertexHandle& _vh, state_t _target_state);
288 MIPS_WARN_WA(Face) // avoid warning
289 MIPS_WARN_WA(Edge) // avoid warning
290};
291
292
293//=============================================================================
294
295
298template <class M> class VVc : public RuleInterfaceT<M>
299{
300 COMPOSITE_RULE( VVc, M );
301private:
302 typedef RuleInterfaceT<M> Base;
303
304public:
306
307 VVc(M& _mesh) : Inherited(_mesh) {}
308
309 void raise(typename M::VertexHandle& _vh, state_t _target_state);
310 MIPS_WARN_WA(Face) // avoid warning
311 MIPS_WARN_WA(Edge) // avoid warning
312};
313
314
315//=============================================================================
316
317
320template <class M> class VE : public RuleInterfaceT<M>
321{
322 COMPOSITE_RULE( VE, M );
323private:
324 typedef RuleInterfaceT<M> Base;
325
326public:
328
329 VE(M& _mesh) : Inherited(_mesh) {}
330
331 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
332 MIPS_WARN_WA(Face ) // avoid warning
333 MIPS_WARN_WA(Vertex) // avoid warning
334};
335
336
337//=============================================================================
338
339
342template <class M> class VdE : public RuleInterfaceT<M>
343{
344 COMPOSITE_RULE( VdE, M );
345private:
346 typedef RuleInterfaceT<M> Base;
347
348public:
350
351 VdE(M& _mesh) : Inherited(_mesh) {}
352
353 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
354 MIPS_WARN_WA(Face ) // avoid warning
355 MIPS_WARN_WA(Vertex) // avoid warning
356};
357
358
359//=============================================================================
360
361
364template <class M> class VdEc : public RuleInterfaceT<M>
365{
366 COMPOSITE_RULE( VdEc, M );
367private:
368 typedef RuleInterfaceT<M> Base;
369
370public:
372
373 VdEc(M& _mesh) : Inherited(_mesh) {}
374
375 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
376 MIPS_WARN_WA(Face ) // avoid warning
377 MIPS_WARN_WA(Vertex) // avoid warning
378};
379
380
381//=============================================================================
382
383
386template <class M> class EV : public RuleInterfaceT<M>
387{
388 COMPOSITE_RULE( EV, M );
389private:
390 typedef RuleInterfaceT<M> Base;
391
392public:
394
395 EV(M& _mesh) : Inherited(_mesh) {}
396
397 void raise(typename M::VertexHandle& _vh, state_t _target_state);
398 MIPS_WARN_WA(Face) // avoid warning
399 MIPS_WARN_WA(Edge) // avoid warning
400};
401
402
403//=============================================================================
404
405
408template <class M> class EVc : public RuleInterfaceT<M>
409{
410 COMPOSITE_RULE( EVc, M );
411private:
412 typedef RuleInterfaceT<M> Base;
413
414public:
415
417
418 EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
419
420 void raise(typename M::VertexHandle& _vh, state_t _target_state);
421 MIPS_WARN_WA(Face) // avoid warning
422 MIPS_WARN_WA(Edge) // avoid warning
423
424 static void init_coeffs(size_t _max_valence);
425 static const std::vector<double>& coeffs() { return coeffs_; }
426
427 double coeff( size_t _valence )
428 {
429 assert(_valence < coeffs_.size());
430 return coeffs_[_valence];
431 }
432
433private:
434
435 static std::vector<double> coeffs_;
436
437};
438
439
440//=============================================================================
441
442
445template <class M> class EF : public RuleInterfaceT<M>
446{
447 COMPOSITE_RULE( EF, M );
448private:
449 typedef RuleInterfaceT<M> Base;
450
451public:
453
454 EF(M& _mesh) : Inherited(_mesh) {}
455
456 void raise(typename M::FaceHandle& _fh, state_t _target_state);
457 MIPS_WARN_WA(Edge ) // avoid warning
458 MIPS_WARN_WA(Vertex) // avoid warning
459};
460
461
462//=============================================================================
463
464
467template <class M> class FE : public RuleInterfaceT<M>
468{
469 COMPOSITE_RULE( FE, M );
470private:
471 typedef RuleInterfaceT<M> Base;
472
473public:
475
476 FE(M& _mesh) : Inherited(_mesh) {}
477
478 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
479 MIPS_WARN_WA(Face ) // avoid warning
480 MIPS_WARN_WA(Vertex) // avoid warning
481};
482
483
484//=============================================================================
485
486
489template <class M> class EdE : public RuleInterfaceT<M>
490{
491 COMPOSITE_RULE( EdE, M );
492private:
493 typedef RuleInterfaceT<M> Base;
494
495public:
497
498 EdE(M& _mesh) : Inherited(_mesh) {}
499
500 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
501 MIPS_WARN_WA(Face ) // avoid warning
502 MIPS_WARN_WA(Vertex) // avoid warning
503};
504
505
506//=============================================================================
507
508
511template <class M> class EdEc : public RuleInterfaceT<M>
512{
513 COMPOSITE_RULE( EdEc, M );
514private:
515 typedef RuleInterfaceT<M> Base;
516
517public:
519
520 EdEc(M& _mesh) : Inherited(_mesh) {}
521
522 void raise(typename M::EdgeHandle& _eh, state_t _target_state);
523 MIPS_WARN_WA(Face ) // avoid warning
524 MIPS_WARN_WA(Vertex) // avoid warning
525};
526
527// ----------------------------------------------------------------------------
528
529#undef MIPS_WARN_WA
530
531//=============================================================================
532} // END_NS_ADAPTIVE
533} // END_NS_SUBDIVIDER
534} // END_NS_OPENMESH
535//=============================================================================
536#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_CC)
537# define OPENMESH_SUBDIVIDER_TEMPLATES
538# include "RulesT.cc"
539#endif
540//=============================================================================
541#endif // OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH defined
542//=============================================================================
543
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:64
CompositeTraits::state_t state_t
Adaptive Composite Subdivision framework.
Definition CompositeTraits.hh:255
Base class for adaptive composite subdivision rules.
Definition RuleInterfaceT.hh:114
Adaptive Composite Subdivision framework.
Definition RulesT.hh:98
Topological composite rule Tvv,4 doing a 1-4 split of a face.
Definition RulesT.hh:121
Composite rule VF.
Definition RulesT.hh:152
void raise(typename M::FaceHandle &_fh, state_t _target_state)
Raise item to target state _target_state.
Composite rule FF.
Definition RulesT.hh:174
void raise(typename M::FaceHandle &_fh, state_t _target_state)
Raise item to target state _target_state.
Composite rule FFc.
Definition RulesT.hh:196
void raise(typename M::FaceHandle &_fh, state_t _target_state)
Raise item to target state _target_state.
Composite rule FV.
Definition RulesT.hh:218
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule FVc.
Definition RulesT.hh:240
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule VV.
Definition RulesT.hh:276
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule VVc.
Definition RulesT.hh:299
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule VE.
Definition RulesT.hh:321
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.
Composite rule VdE.
Definition RulesT.hh:343
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.
Composite rule VdEc.
Definition RulesT.hh:365
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.
Composite rule EV.
Definition RulesT.hh:387
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule EVc.
Definition RulesT.hh:409
void raise(typename M::VertexHandle &_vh, state_t _target_state)
Raise item to target state _target_state.
Composite rule EF.
Definition RulesT.hh:446
void raise(typename M::FaceHandle &_fh, state_t _target_state)
Raise item to target state _target_state.
Composite rule FE.
Definition RulesT.hh:468
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.
Composite rule EdE.
Definition RulesT.hh:490
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.
Composite rule EdEc.
Definition RulesT.hh:512
void raise(typename M::EdgeHandle &_eh, state_t _target_state)
Raise item to target state _target_state.

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