OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Sqrt3InterpolatingSubdividerLabsikGreinerT.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: 410 $ *
38 * $Date: 2010-06-17 12:45:58 +0200 (Do, 17. Jun 2010) $ *
39 * *
40 \*==========================================================================*/
41 
51 //=============================================================================
52 //
53 // CLASS InterpolatingSqrt3LGT
54 //
55 //=============================================================================
56 
57 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_INTERP_SQRT3T_LABSIK_GREINER_HH
58 #define OPENMESH_SUBDIVIDER_UNIFORM_INTERP_SQRT3T_LABSIK_GREINER_HH
59 
60 
61 //== INCLUDES =================================================================
62 
63 #include <OpenMesh/Core/Mesh/Handles.hh>
64 #include <OpenMesh/Core/System/config.hh>
66 
67 #if defined(_DEBUG) || defined(DEBUG)
68 // Makes life lot easier, when playing/messing around with low-level topology
69 // changing methods of OpenMesh
70 # include <OpenMesh/Tools/Utils/MeshCheckerT.hh>
71 # define ASSERT_CONSISTENCY( T, m ) \
72  assert(OpenMesh::Utils::MeshCheckerT<T>(m).check())
73 #else
74 # define ASSERT_CONSISTENCY( T, m )
75 #endif
76 // -------------------- STL
77 #include <vector>
78 #if defined(OM_CC_MIPS)
79 # include <math.h>
80 #else
81 # include <cmath>
82 #endif
83 
84 //#define MIRROR_TRIANGLES
85 //#define MIN_NORM
86 
87 //== NAMESPACE ================================================================
88 
89 namespace OpenMesh { // BEGIN_NS_OPENMESH
90 namespace Subdivider { // BEGIN_NS_DECIMATER
91 namespace Uniform { // BEGIN_NS_UNIFORM
92 
93 
94 //== CLASS DEFINITION =========================================================
95 
96 
105 template <typename MeshType, typename RealType = float>
106 class InterpolatingSqrt3LGT : public SubdividerT< MeshType, RealType >
107 {
108 public:
109 
110  typedef RealType real_t;
111  typedef MeshType mesh_t;
113 
114  typedef std::vector< std::vector<real_t> > weights_t;
115 
116 public:
117 
118 
119  InterpolatingSqrt3LGT(void) : parent_t()
120  { init_weights(); }
121 
122  InterpolatingSqrt3LGT(MeshType &_m) : parent_t(_m)
123  { init_weights(); }
124 
125  virtual ~InterpolatingSqrt3LGT() {}
126 
127 
128 public:
129 
130 
131  const char *name() const { return "Uniform Interpolating Sqrt3"; }
132 
134  void init_weights(size_t _max_valence=50)
135  {
136  weights_.resize(_max_valence);
137 
138  weights_[3].resize(4);
139  weights_[3][0] = real_t(+4.0/27);
140  weights_[3][1] = real_t(-5.0/27);
141  weights_[3][2] = real_t(+4.0/27);
142  weights_[3][3] = real_t(+8.0/9);
143 
144  weights_[4].resize(5);
145  weights_[4][0] = real_t(+2.0/9);
146  weights_[4][1] = real_t(-1.0/9);
147  weights_[4][2] = real_t(-1.0/9);
148  weights_[4][3] = real_t(+2.0/9);
149  weights_[4][4] = real_t(+7.0/9);
150 
151  for(unsigned int K=5; K<_max_valence; ++K)
152  {
153  weights_[K].resize(K+1);
154  real_t aH = 2.0*cos(M_PI/K)/3.0;
155  weights_[K][K] = 1.0 - aH*aH;
156  for(unsigned int i=0; i<K; ++i)
157  {
158  weights_[K][i] = (aH*aH + 2.0*aH*cos(2.0*i*M_PI/K + M_PI/K) + 2.0*aH*aH*cos(4.0*i*M_PI/K + 2.0*M_PI/K))/K;
159  }
160  }
161 
162  //just to be sure:
163  weights_[6].resize(0);
164 
165  }
166 
167 
168 protected:
169 
170 
171  bool prepare( MeshType& _m )
172  {
173  _m.request_edge_status();
174  _m.add_property( fp_pos_ );
175  _m.add_property( ep_nv_ );
176  _m.add_property( mp_gen_ );
177  _m.property( mp_gen_ ) = 0;
178 
179  return _m.has_edge_status()
180  && ep_nv_.is_valid() && mp_gen_.is_valid();
181  }
182 
183 
184  bool cleanup( MeshType& _m )
185  {
186  _m.release_edge_status();
187  _m.remove_property( fp_pos_ );
188  _m.remove_property( ep_nv_ );
189  _m.remove_property( mp_gen_ );
190  return true;
191  }
192 
193 
194  bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true)
195  {
196 
198 
199  typename MeshType::VertexIter vit;
200  typename MeshType::VertexVertexIter vvit;
201  typename MeshType::EdgeIter eit;
202  typename MeshType::FaceIter fit;
203  typename MeshType::FaceVertexIter fvit;
204  typename MeshType::FaceHalfedgeIter fheit;
205  typename MeshType::VertexHandle vh;
206  typename MeshType::HalfedgeHandle heh;
207  typename MeshType::Point pos(0,0,0), zero(0,0,0);
208  size_t &gen = _m.property( mp_gen_ );
209 
210  for (size_t l=0; l<_n; ++l)
211  {
212  // tag existing edges
213  for (eit=_m.edges_begin(); eit != _m.edges_end();++eit)
214  {
215  _m.status( *eit ).set_tagged( true );
216  if ( (gen%2) && _m.is_boundary(*eit) )
217  compute_new_boundary_points( _m, *eit ); // *) creates new vertices
218  }
219 
220  // insert new vertices, and store pos in vp_pos_
221  typename MeshType::FaceIter fend = _m.faces_end();
222  for (fit = _m.faces_begin();fit != fend; ++fit)
223  {
224  if (_m.is_boundary(*fit))
225  {
226  if(gen%2)
227  _m.property(fp_pos_, *fit).invalidate();
228  else
229  {
230  //find the interior boundary halfedge
231  for( heh = _m.halfedge_handle(*fit); !_m.is_boundary( _m.opposite_halfedge_handle(heh) ); heh = _m.next_halfedge_handle(heh) )
232  ;
233  assert(_m.is_boundary( _m.opposite_halfedge_handle(heh) ));
234  pos = zero;
235  //check for two boundaries case:
236  if( _m.is_boundary(_m.next_halfedge_handle(heh)) || _m.is_boundary(_m.prev_halfedge_handle(heh)) )
237  {
238  if(_m.is_boundary(_m.prev_halfedge_handle(heh)))
239  heh = _m.prev_halfedge_handle(heh); //ensure that the boundary halfedges are heh and heh->next
240  //check for three boundaries case:
241  if(_m.is_boundary(_m.next_halfedge_handle(_m.next_halfedge_handle(heh))))
242  {
243  //three boundaries, use COG of triangle
244  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(heh));
245  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
246  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(_m.prev_halfedge_handle(heh)));
247  }
248  else
249  {
250 #ifdef MIRROR_TRIANGLES
251  //two boundaries, mirror two triangles
252  pos += real_t(2.0/9) * _m.point(_m.to_vertex_handle(heh));
253  pos += real_t(4.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
254  pos += real_t(4.0/9) * _m.point(_m.to_vertex_handle(_m.prev_halfedge_handle(heh)));
255  pos += real_t(-1.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)))));
256 #else
257  pos += real_t(7.0/24) * _m.point(_m.to_vertex_handle(heh));
258  pos += real_t(3.0/8) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
259  pos += real_t(3.0/8) * _m.point(_m.to_vertex_handle(_m.prev_halfedge_handle(heh)));
260  pos += real_t(-1.0/24) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)))));
261 #endif
262  }
263  }
264  else
265  {
266  vh = _m.to_vertex_handle(_m.next_halfedge_handle(heh));
267  //check last vertex regularity
268  if((_m.valence(vh) == 6) || _m.is_boundary(vh))
269  {
270 #ifdef MIRROR_TRIANGLES
271  //use regular rule and mirror one triangle
272  pos += real_t(5.0/9) * _m.point(vh);
273  pos += real_t(3.0/9) * _m.point(_m.to_vertex_handle(heh));
274  pos += real_t(3.0/9) * _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(heh)));
275  pos += real_t(-1.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.next_halfedge_handle(heh)))));
276  pos += real_t(-1.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)))));
277 #else
278 #ifdef MIN_NORM
279  pos += real_t(1.0/9) * _m.point(vh);
280  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(heh));
281  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(heh)));
282  pos += real_t(1.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.next_halfedge_handle(heh)))));
283  pos += real_t(1.0/9) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)))));
284 #else
285  pos += real_t(1.0/2) * _m.point(vh);
286  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(heh));
287  pos += real_t(1.0/3) * _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(heh)));
288  pos += real_t(-1.0/12) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.next_halfedge_handle(heh)))));
289  pos += real_t(-1.0/12) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)))));
290 #endif
291 #endif
292  }
293  else
294  {
295  //irregular setting, use usual irregular rule
296  unsigned int K = _m.valence(vh);
297  pos += weights_[K][K]*_m.point(vh);
298  heh = _m.opposite_halfedge_handle( _m.next_halfedge_handle(heh) );
299  for(unsigned int i = 0; i<K; ++i, heh = _m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)) )
300  {
301  pos += weights_[K][i]*_m.point(_m.to_vertex_handle(heh));
302  }
303  }
304  }
305  vh = _m.add_vertex( pos );
306  _m.property(fp_pos_, *fit) = vh;
307  }
308  }
309  else
310  {
311  pos = zero;
312  int nOrdinary = 0;
313 
314  //check number of extraordinary vertices
315  for(fvit = _m.fv_iter( *fit ); fvit.is_valid(); ++fvit)
316  if( (_m.valence(*fvit)) == 6 || _m.is_boundary(*fvit) )
317  ++nOrdinary;
318 
319  if(nOrdinary==3)
320  {
321  for(fheit = _m.fh_iter( *fit ); fheit.is_valid(); ++fheit)
322  {
323  //one ring vertex has weight 32/81
324  heh = *fheit;
325  assert(_m.to_vertex_handle(heh).is_valid());
326  pos += real_t(32.0/81) * _m.point(_m.to_vertex_handle(heh));
327  //tip vertex has weight -1/81
328  heh = _m.opposite_halfedge_handle(heh);
329  assert(heh.is_valid());
330  assert(_m.next_halfedge_handle(heh).is_valid());
331  assert(_m.to_vertex_handle(_m.next_halfedge_handle(heh)).is_valid());
332  pos -= real_t(1.0/81) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
333  //outer vertices have weight -2/81
334  heh = _m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh));
335  assert(heh.is_valid());
336  assert(_m.next_halfedge_handle(heh).is_valid());
337  assert(_m.to_vertex_handle(_m.next_halfedge_handle(heh)).is_valid());
338  pos -= real_t(2.0/81) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
339  heh = _m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh));
340  assert(heh.is_valid());
341  assert(_m.next_halfedge_handle(heh).is_valid());
342  assert(_m.to_vertex_handle(_m.next_halfedge_handle(heh)).is_valid());
343  pos -= real_t(2.0/81) * _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(heh)));
344  }
345  }
346  else
347  {
348  //only use irregular vertices:
349  for(fheit = _m.fh_iter( *fit ); fheit.is_valid(); ++fheit)
350  {
351  vh = _m.to_vertex_handle(*fheit);
352  if( (_m.valence(vh) != 6) && (!_m.is_boundary(vh)) )
353  {
354  unsigned int K = _m.valence(vh);
355  pos += weights_[K][K]*_m.point(vh);
356  heh = _m.opposite_halfedge_handle( *fheit );
357  for(unsigned int i = 0; i<K; ++i, heh = _m.opposite_halfedge_handle(_m.prev_halfedge_handle(heh)) )
358  {
359  pos += weights_[K][i]*_m.point(_m.to_vertex_handle(heh));
360  }
361  }
362  }
363  pos *= real_t(1.0/(3-nOrdinary));
364  }
365 
366  vh = _m.add_vertex( pos );
367  _m.property(fp_pos_, *fit) = vh;
368  }
369  }
370 
371  //split faces
372  for (fit = _m.faces_begin();fit != fend; ++fit)
373  {
374  if ( _m.is_boundary(*fit) && (gen%2))
375  {
376  boundary_split( _m, *fit );
377  }
378  else
379  {
380  assert(_m.property(fp_pos_, *fit).is_valid());
381  _m.split( *fit, _m.property(fp_pos_, *fit) );
382  }
383  }
384 
385  // flip old edges
386  for (eit=_m.edges_begin(); eit != _m.edges_end(); ++eit)
387  if ( _m.status( *eit ).tagged() && !_m.is_boundary( *eit ) )
388  _m.flip(*eit);
389 
390  // Now we have an consistent mesh!
391  ASSERT_CONSISTENCY( MeshType, _m );
392 
393  // increase generation by one
394  ++gen;
395  }
396  return true;
397  }
398 
399 private:
400 
401  // Pre-compute location of new boundary points for odd generations
402  // and store them in the edge property ep_nv_;
403  void compute_new_boundary_points( MeshType& _m,
404  const typename MeshType::EdgeHandle& _eh)
405  {
406  assert( _m.is_boundary(_eh) );
407 
408  typename MeshType::HalfedgeHandle heh;
409  typename MeshType::VertexHandle vh1, vh2, vh3, vh4, vhl, vhr;
410  typename MeshType::Point zero(0,0,0), P1, P2, P3, P4;
411 
412  /*
413  // *---------*---------*
414  // / \ / \ / \
415  // / \ / \ / \
416  // / \ / \ / \
417  // / \ / \ / \
418  // *---------*--#---#--*---------*
419  //
420  // ^ ^ ^ ^ ^ ^
421  // P1 P2 pl pr P3 P4
422  */
423  // get halfedge pointing from P3 to P2 (outer boundary halfedge)
424 
425  heh = _m.halfedge_handle(_eh,
426  _m.is_boundary(_m.halfedge_handle(_eh,1)));
427 
428  assert( _m.is_boundary( _m.next_halfedge_handle( heh ) ) );
429  assert( _m.is_boundary( _m.prev_halfedge_handle( heh ) ) );
430 
431  vh1 = _m.to_vertex_handle( _m.next_halfedge_handle( heh ) );
432  vh2 = _m.to_vertex_handle( heh );
433  vh3 = _m.from_vertex_handle( heh );
434  vh4 = _m.from_vertex_handle( _m.prev_halfedge_handle( heh ));
435 
436  P1 = _m.point(vh1);
437  P2 = _m.point(vh2);
438  P3 = _m.point(vh3);
439  P4 = _m.point(vh4);
440 
441  vhl = _m.add_vertex(real_t(-5.0/81)*P1 + real_t(20.0/27)*P2 + real_t(10.0/27)*P3 + real_t(-4.0/81)*P4);
442  vhr = _m.add_vertex(real_t(-5.0/81)*P4 + real_t(20.0/27)*P3 + real_t(10.0/27)*P2 + real_t(-4.0/81)*P1);
443 
444  _m.property(ep_nv_, _eh).first = vhl;
445  _m.property(ep_nv_, _eh).second = vhr;
446  }
447 
448 
449  void boundary_split( MeshType& _m, const typename MeshType::FaceHandle& _fh )
450  {
451  assert( _m.is_boundary(_fh) );
452 
453  typename MeshType::VertexHandle vhl, vhr;
454  typename MeshType::FaceEdgeIter fe_it;
455  typename MeshType::HalfedgeHandle heh;
456 
457  // find boundary edge
458  for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( *fe_it ); ++fe_it ) {};
459 
460  // use precomputed, already inserted but not linked vertices
461  vhl = _m.property(ep_nv_, *fe_it).first;
462  vhr = _m.property(ep_nv_, *fe_it).second;
463 
464  /*
465  // *---------*---------*
466  // / \ / \ / \
467  // / \ / \ / \
468  // / \ / \ / \
469  // / \ / \ / \
470  // *---------*--#---#--*---------*
471  //
472  // ^ ^ ^ ^ ^ ^
473  // P1 P2 pl pr P3 P4
474  */
475  // get halfedge pointing from P2 to P3 (inner boundary halfedge)
476 
477  heh = _m.halfedge_handle(*fe_it, _m.is_boundary(_m.halfedge_handle(*fe_it,0)));
478 
479  typename MeshType::HalfedgeHandle pl_P3;
480 
481  // split P2->P3 (heh) in P2->pl (heh) and pl->P3
482  boundary_split( _m, heh, vhl ); // split edge
483  pl_P3 = _m.next_halfedge_handle( heh ); // store next halfedge handle
484  boundary_split( _m, heh ); // split face
485 
486  // split pl->P3 in pl->pr and pr->P3
487  boundary_split( _m, pl_P3, vhr );
488  boundary_split( _m, pl_P3 );
489 
490  assert( _m.is_boundary( vhl ) && _m.halfedge_handle(vhl).is_valid() );
491  assert( _m.is_boundary( vhr ) && _m.halfedge_handle(vhr).is_valid() );
492  }
493 
494  void boundary_split(MeshType& _m,
495  const typename MeshType::HalfedgeHandle& _heh,
496  const typename MeshType::VertexHandle& _vh)
497  {
498  assert( _m.is_boundary( _m.edge_handle(_heh) ) );
499 
500  typename MeshType::HalfedgeHandle
501  heh(_heh),
502  opp_heh( _m.opposite_halfedge_handle(_heh) ),
503  new_heh, opp_new_heh;
504  typename MeshType::VertexHandle to_vh(_m.to_vertex_handle(heh));
505  typename MeshType::HalfedgeHandle t_heh;
506 
507  /*
508  * P5
509  * *
510  * /|\
511  * / \
512  * / \
513  * / \
514  * / \
515  * /_ heh new \
516  * *-----\*-----\*\-----*
517  * ^ ^ t_heh
518  * _vh to_vh
519  *
520  * P1 P2 P3 P4
521  */
522  // Re-Setting Handles
523 
524  // find halfedge point from P4 to P3
525  for(t_heh = heh;
526  _m.next_halfedge_handle(t_heh) != opp_heh;
527  t_heh = _m.opposite_halfedge_handle(_m.next_halfedge_handle(t_heh)))
528  {}
529 
530  assert( _m.is_boundary( t_heh ) );
531 
532  new_heh = _m.new_edge( _vh, to_vh );
533  opp_new_heh = _m.opposite_halfedge_handle(new_heh);
534 
535  // update halfedge connectivity
536  _m.set_next_halfedge_handle(t_heh, opp_new_heh); // P4-P3 -> P3-P2
537  _m.set_next_halfedge_handle(new_heh, _m.next_halfedge_handle(heh)); // P2-P3 -> P3-P5
538  _m.set_next_halfedge_handle(heh, new_heh); // P1-P2 -> P2-P3
539  _m.set_next_halfedge_handle(opp_new_heh, opp_heh); // P3-P2 -> P2-P1
540 
541  // both opposite halfedges point to same face
542  _m.set_face_handle(opp_new_heh, _m.face_handle(opp_heh));
543 
544  // let heh finally point to new inserted vertex
545  _m.set_vertex_handle(heh, _vh);
546 
547  // let heh and new_heh point to same face
548  _m.set_face_handle(new_heh, _m.face_handle(heh));
549 
550  // let opp_new_heh be the new outgoing halfedge for to_vh
551  // (replaces for opp_heh)
552  _m.set_halfedge_handle( to_vh, opp_new_heh );
553 
554  // let opp_heh be the outgoing halfedge for _vh
555  _m.set_halfedge_handle( _vh, opp_heh );
556  }
557 
558  void boundary_split( MeshType& _m,
559  const typename MeshType::HalfedgeHandle& _heh)
560  {
561  assert( _m.is_boundary( _m.opposite_halfedge_handle( _heh ) ) );
562 
563  typename MeshType::HalfedgeHandle
564  heh(_heh),
565  n_heh(_m.next_halfedge_handle(heh));
566 
567  typename MeshType::VertexHandle
568  to_vh(_m.to_vertex_handle(heh));
569 
570  typename MeshType::HalfedgeHandle
571  heh2(_m.new_edge(to_vh,
572  _m.to_vertex_handle(_m.next_halfedge_handle(n_heh)))),
573  heh3(_m.opposite_halfedge_handle(heh2));
574 
575  typename MeshType::FaceHandle
576  new_fh(_m.new_face()),
577  fh(_m.face_handle(heh));
578 
579  // Relink (half)edges
580  _m.set_face_handle(heh, new_fh);
581  _m.set_face_handle(heh2, new_fh);
582  _m.set_next_halfedge_handle(heh2, _m.next_halfedge_handle(_m.next_halfedge_handle(n_heh)));
583  _m.set_next_halfedge_handle(heh, heh2);
584  _m.set_face_handle( _m.next_halfedge_handle(heh2), new_fh);
585 
586  _m.set_next_halfedge_handle(heh3, n_heh);
587  _m.set_next_halfedge_handle(_m.next_halfedge_handle(n_heh), heh3);
588  _m.set_face_handle(heh3, fh);
589 
590  _m.set_halfedge_handle( fh, n_heh);
591  _m.set_halfedge_handle(new_fh, heh);
592 
593 
594  }
595 
596 private:
597 
598  weights_t weights_;
600  OpenMesh::EPropHandleT< std::pair< typename MeshType::VertexHandle,
601  typename MeshType::VertexHandle> > ep_nv_;
603 };
604 
605 
606 //=============================================================================
607 } // END_NS_UNIFORM
608 } // END_NS_SUBDIVIDER
609 } // END_NS_OPENMESH
610 //=============================================================================
611 #endif // OPENMESH_SUBDIVIDER_UNIFORM_SQRT3T_HH
612 //=============================================================================
bool is_valid() const
The handle is valid iff the index is not equal to -1.
Definition: Handles.hh:70
bool prepare(MeshType &_m)
Prepare mesh, e.g. add properties.
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:171
bool subdivide(MeshType &_m, size_t _n, const bool _update_points=true)
Subdivide mesh _m _n times.
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:194
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
void init_weights(size_t _max_valence=50)
Pre-compute weights.
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:134
Handle representing an edge property.
Definition: Property.hh:504
Handle representing a face property.
Definition: Property.hh:518
Abstract base class for uniform subdivision algorithms.
Definition: SubdividerT.hh:87
Uniform Interpolating Sqrt3 subdivision algorithm
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:106
bool cleanup(MeshType &_m)
Cleanup mesh after usage, e.g. remove added properties.
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:184
const char * name() const
Return name of subdivision algorithm.
Definition: Sqrt3InterpolatingSubdividerLabsikGreinerT.hh:131

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