47
47
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
48
48
res && it.cont(); ++it )
50
if (it->template beta<i+2>()->template beta<i+1>()!=
51
it->template beta_inv<i+1>()->template beta<i+2>() )
50
if ( amap.template beta<i+2,i+1>(it)!=
51
amap.template beta<CGAL_BETAINV(i+1),i+2>(it) )
97
97
typename CMap::Dart_handle d1, d2;
98
typename CMap::Dart_handle dg1=NULL, dg2=NULL;
98
typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
100
100
int mark = amap.get_new_mark();
101
101
int mark_modified_darts = amap.get_new_mark();
109
109
it.cont(); ++it )
111
111
to_erase.push_back(it);
112
if ( !it->template is_free<i+1>() && dg1==NULL )
113
{ dg1=it; dg2=it->template beta<i+1>(); }
112
if ( !amap.template is_free<i+1>(it) && dg1==amap.null_handle )
113
{ dg1=it; dg2=amap.template beta<i+1>(it); }
114
114
amap.mark(it, mark);
118
118
// We group the two (i+1)-cells incident if they exist.
119
if ( dg1!=amap.null_handle )
120
120
CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
121
121
run(&amap, dg1, dg2);
137
137
to_erase.begin();
138
138
for ( ; it!=to_erase.end(); ++it )
140
d1=(*it)->template beta<iinv>();
141
while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
140
d1=amap.template beta<iinv>(*it);
141
while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
143
d1=d1->template beta<i+1>()->template beta<iinv>();
144
if ( d1==(*it)->template beta<iinv>() ) d1=CMap::null_dart_handle;
143
d1=amap.template beta<i+1, iinv>(d1);
144
if ( d1==amap. template beta<iinv>(*it) ) d1=amap.null_dart_handle;
147
147
if ( !amap.is_marked(d1, mark_modified_darts) )
149
d2=(*it)->template beta<i+1>()->template beta<i>();
150
while ( d2!=CMap::null_dart_handle && amap.is_marked(d2, mark) )
149
d2=amap.template beta<i+1,i>(*it);
150
while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
152
d2=d2->template beta<i+1>()->template beta<i>();
153
if ( d2==(*it)->template beta<i+1>()->template beta<i>() )
154
d2=CMap::null_dart_handle;
152
d2=amap.template beta<i+1,i>(d2);
153
if ( d2==amap.template beta<i+1,i>(*it) )
154
d2=amap.null_dart_handle;
157
157
if ( !amap.is_marked(d2, mark_modified_darts) )
159
if ( d1!=CMap::null_dart_handle )
159
if ( d1!=amap.null_dart_handle )
161
if ( d2!=CMap::null_dart_handle && d1!=d2 )
161
if ( d2!=amap.null_dart_handle && d1!=d2 )
163
163
//d1->basic_link_beta(d2, i);
164
164
amap.template basic_link_beta<i>(d1, d2);
179
if ( !d1->template is_free<i>() )
179
if ( !amap.template is_free<i>(d1) )
181
d1->template unlink_beta<i>();
181
amap.template unlink_beta<i>(d1);
182
182
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
183
183
amap.mark(d1, mark_modified_darts);
184
184
first_modified_darts.push_back(d1);
188
else if ( d2!=CMap::null_dart_handle )
188
else if ( d2!=amap.null_dart_handle )
190
if ( !d2->template is_free<iinv>() )
190
if ( !amap.template is_free<iinv>(d2) )
192
d2->template unlink_beta<iinv>();
192
amap.template unlink_beta<iinv>(d2);
193
193
CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
194
194
amap.mark(d2, mark_modified_darts);
195
195
modified_darts.push_back(d2);
200
if ( (*it)->template is_free<i+1>() &&
201
!(*it)->template is_free<i>() )
200
if ( amap.template is_free<i+1>(*it) &&
201
!amap.template is_free<i>(*it) )
203
d1 = (*it)->template beta<i>();
204
if ( !d1->template is_free<iinv>() )
203
d1 = amap.template beta<i>(*it);
204
if ( !amap.template is_free<iinv>(d1) )
206
d1->template unlink_beta<iinv>();
206
amap.template unlink_beta<iinv>(d1);
207
207
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
208
208
amap.mark(d1, mark_modified_darts);
209
209
modified_darts.push_back(d1);
292
290
it = to_erase.begin();
293
291
for ( it = to_erase.begin(); it != to_erase.end(); ++it )
295
if ( !(*it)->template is_free<CMap::dimension>() &&
296
!amap.is_marked((*it)->template beta<CMap::dimension>(), mark) )
293
if ( !amap.template is_free<CMap::dimension>(*it) &&
294
!amap.is_marked(amap.template beta<CMap::dimension>(*it), mark) )
298
modified_darts.push_back((*it)->template beta<CMap::dimension>());
296
modified_darts.push_back(amap.template beta<CMap::dimension>(*it));
299
297
amap.template unlink_beta_for_involution<CMap::dimension>(*it);
338
336
typename CMap::Dart_handle d1, d2;
339
typename CMap::Dart_handle dg1=NULL, dg2=NULL;
337
typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
341
339
int mark = amap.get_new_mark();
342
340
// int mark_modified_darts = amap.get_new_mark();
347
345
it.cont(); ++it )
349
347
to_erase.push_back(it);
350
if ( !it->template is_free<0>() && dg1==NULL )
351
{ dg1=it; dg2=it->template beta<0>(); }
348
if ( !amap.template is_free<0>(it) && dg1==amap.null_handle )
349
{ dg1=it; dg2=amap.template beta<0>(it); }
352
350
amap.mark(it, mark);
356
354
// We group the two edges incident if they exist.
355
if ( dg1!=amap.null_handle )
358
356
CGAL::internal::Group_attribute_functor_run<CMap, 1>::
359
357
run(&amap, dg1, dg2);
369
367
to_erase.begin();
370
368
for ( ; it != to_erase.end(); ++it)
372
if ( !(*it)->template is_free<0>() )
370
if ( !amap.template is_free<0>(*it) )
374
if ( !(*it)->template is_free<1>() &&
375
(*it)->template beta<0>()!=(*it) )
372
if ( !amap.template is_free<1>(*it) &&
373
amap.template beta<0>(*it)!=(*it) )
377
amap.basic_link_beta_1((*it)->template beta<0>(),
378
(*it)->template beta<1>());
379
modified_darts.push_back((*it)->template beta<0>());
380
modified_darts2.push_back((*it)->template beta<1>());
375
amap.basic_link_beta_1(amap.template beta<0>(*it),
376
amap.template beta<1>(*it));
377
modified_darts.push_back(amap.template beta<0>(*it));
378
modified_darts2.push_back(amap.template beta<1>(*it));
381
379
// TODO push only one out of two dart ?
385
(*it)->template beta<0>()->template unlink_beta<1>();
386
modified_darts.push_back((*it)->template beta<0>());
383
amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
384
modified_darts.push_back(amap.template beta<0>(*it));
389
387
for ( unsigned int j=2; j<=CMap::dimension; ++j )
391
if ( !(*it)->is_free(j) )
389
if ( !amap.is_free(*it,j) )
393
amap.basic_link_beta((*it)->template beta<0>(),
391
amap.basic_link_beta(amap.template beta<0>(*it),
392
amap.beta(*it,j), j);
395
393
//((*it)->beta(0))->basic_link_beta((*it)->beta(j),j);
401
if ( !(*it)->template is_free<1>() )
399
if ( !amap.template is_free<1>(*it) )
403
(*it)->template beta<1>()->template unlink_beta<0>();
404
modified_darts2.push_back((*it)->template beta<1>());
401
amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
402
modified_darts2.push_back(amap.template beta<1>(*it));
407
405
for ( unsigned int j=2; j<=CMap::dimension; ++j )
409
if ( !(*it)->is_free(j) )
407
if ( !amap.is_free(*it,j) )
410
408
{ amap.unlink_beta(*it, j); }
461
459
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
462
460
res && it.cont(); ++it )
464
if ( it->template beta<i-2>()->template beta<i-1>()!=
465
it->template beta<i-1>()->template beta_inv<i-2>() )
462
if ( amap.template beta<i-2,i-1>(it)!=
463
amap.template beta<i-1,CGAL_BETAINV(i-2)>(it) )
511
509
typename CMap::Dart_handle d1, d2;
512
typename CMap::Dart_handle dg1=NULL, dg2=NULL;
510
typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
514
512
int mark = amap.get_new_mark();
515
513
int mark_modified_darts = amap.get_new_mark();
522
520
it.cont(); ++it )
524
522
to_erase.push_back(it);
525
if ( !it->template is_free<i-1>() && dg1==NULL )
526
{ dg1=it; dg2=it->template beta<i-1>(); }
523
if ( !amap.template is_free<i-1>(it) && dg1==amap.null_handle )
524
{ dg1=it; dg2=amap.template beta<i-1>(it); }
527
525
amap.mark(it, mark);
531
529
// We group the two (i+1)-cells incident if they exist.
530
if ( dg1!=amap.null_handle )
533
531
CGAL::internal::Group_attribute_functor_run<CMap,i-1>::
534
532
run(&amap, dg1, dg2);
542
540
to_erase.begin();
543
541
for ( ; it!=to_erase.end(); ++it )
545
d1 = (*it)->template beta<i>();
546
while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
543
d1 = amap.template beta<i>(*it);
544
while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
548
d1 = d1->template beta<imuinv>()->template beta<i>();
549
if (d1 == (*it)->template beta<i>()) d1 = CMap::null_dart_handle;
546
d1 = amap.template beta<imuinv,i>(d1);
547
if (d1 == amap.template beta<i>(*it)) d1 = amap.null_dart_handle;
552
550
if ( !amap.is_marked(d1, mark_modified_darts) )
554
d2 = (*it)->template beta<i-1>()->template beta<i>();
555
while ( d2!=CMap::null_dart_handle && amap.is_marked(d2, mark) )
552
d2 = amap.template beta<i-1,i>(*it);
553
while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
557
d2 = d2->template beta<i-1>()->template beta<i>();
558
if ( d2==(*it)->template beta<i-1>()->template beta<i>() )
559
d2=CMap::null_dart_handle;
555
d2 = amap.template beta<i-1,i>(d2);
556
if ( d2==amap.template beta<i-1,i>(*it) )
557
d2=amap.null_dart_handle;
562
560
if ( !amap.is_marked(d2, mark_modified_darts) )
564
if (d1 != CMap::null_dart_handle)
562
if (d1 != amap.null_dart_handle)
566
if (d2 != CMap::null_dart_handle && d1!=d2 )
564
if (d2 != amap.null_dart_handle && d1!=d2 )
568
566
amap.template basic_link_beta_for_involution<i>(d1, d2);
569
567
amap.mark(d1, mark_modified_darts);
577
if ( !d1->template is_free<i>() )
575
if ( !amap.template is_free<i>(d1) )
579
d1->template unlink_beta<i>();
577
amap.template unlink_beta<i>(d1);
580
578
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
581
579
amap.mark(d1, mark_modified_darts);
582
580
modified_darts.push_back(d1);
586
else if (d2 != CMap::null_dart_handle)
584
else if (d2 != amap.null_dart_handle)
588
if ( !d2->is_free(i) )
586
if ( !amap.is_free(d2,i) )
590
d2->template unlink_beta<i>();
588
amap.template unlink_beta<i>(d2);
591
589
CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
592
590
amap.mark(d2, mark_modified_darts);
593
591
modified_darts.push_back(d2);
598
if ((*it)->is_free(i-1) && !(*it)->is_free(i))
596
if (amap.is_free(*it,i-1) && !amap.is_free(*it,i))
601
if ( !d1->is_free(i) )
598
d1 = amap.beta(*it,i);
599
if ( !amap.is_free(d1,i) )
603
d1->template unlink_beta<i>();
601
amap.template unlink_beta<i>(d1);
604
602
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
605
603
amap.mark(d1, mark_modified_darts);
606
604
modified_darts.push_back(d1);
660
658
typename CMap::Dart_handle d1, d2;
661
typename CMap::Dart_handle dg1=NULL, dg2=NULL;
659
typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
663
661
int mark = amap.get_new_mark();
664
662
// int mark_modified_darts = amap.get_new_mark();
669
667
it.cont(); ++it )
671
669
to_erase.push_back(it);
672
if ( dg1==NULL && !it->template is_free<0>() &&
673
!it->template is_free<1>() )
674
{ dg1=it->template beta<0>(); dg2=it->template beta<1>(); }
670
if ( dg1==amap.null_handle && !amap.template is_free<0>(it) &&
671
!amap.template is_free<1>(it) )
672
{ dg1=amap.template beta<0>(it); dg2=amap.template beta<1>(it); }
675
673
amap.mark(it, mark);
679
677
// We group the two vertices incident if they exist.
678
if ( dg1!=amap.null_handle )
681
679
CGAL::internal::Group_attribute_functor_run<CMap, 0, 1>::
682
680
run(&amap, dg1, dg2);
692
690
to_erase.begin();
693
691
for ( ; it!=to_erase.end(); ++it )
695
if ( !(*it)->template is_free<0>() )
693
if ( !amap.template is_free<0>(*it) )
697
if ( !(*it)->template is_free<1>() )
695
if ( !amap.template is_free<1>(*it) )
699
if ( (*it)->template beta<1>()!=*it )
697
if ( amap.template beta<1>(*it)!=*it )
701
699
/*modified_darts2.push_back((*it)->template beta<0>());
702
700
if ( (*it)->beta(0)!=(*it)->beta(1) )*/
703
modified_darts.push_back((*it)->template beta<1>());
704
amap.basic_link_beta_1((*it)->template beta<0>(),
705
(*it)->template beta<1>());
701
modified_darts.push_back(amap.template beta<1>(*it));
702
amap.basic_link_beta_1(amap.template beta<0>(*it),
703
amap.template beta<1>(*it));
710
modified_darts2.push_back((*it)->template beta<0>());
711
(*it)->template beta<0>()->template unlink_beta<1>();
708
modified_darts2.push_back(amap.template beta<0>(*it));
709
amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
716
if ( !(*it)->template is_free<1>() )
714
if ( !amap.template is_free<1>(*it) )
718
modified_darts.push_back((*it)->template beta<1>());
719
(*it)->template beta<1>()->template unlink_beta<0>();
716
modified_darts.push_back(amap.template beta<1>(*it));
717
amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));