Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
g-map.icc
Go to the documentation of this file.
1 /*
2  * lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-gmapkernel
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include "dart.hh"
26 #include "embedding.hh"
27 #include "dynamic-coverage.hh"
28 #include "static-coverage.hh"
29 #include <cassert>
30 //******************************************************************************
31 namespace GMap3d
32 {
33 //******************************************************************************
34 INLINE
36  : CGMapBasic()
37 {
38 }
39 //******************************************************************************
40 INLINE
42 {
43  switch (AOrbit)
44  {
45  case ORBIT_SELF: return new CDynamicCoverageSelf (this,ADart );
46  case ORBIT_0: return new CDynamicCoverage0 (this,ADart );
47  case ORBIT_1: return new CDynamicCoverage1 (this,ADart );
48  case ORBIT_01: return new CDynamicCoverage01 (this,ADart );
49  case ORBIT_2: return new CDynamicCoverage2 (this,ADart );
50  case ORBIT_02: return new CDynamicCoverage02 (this,ADart );
51  case ORBIT_12: return new CDynamicCoverage12 (this,ADart );
52  case ORBIT_012: return new CDynamicCoverage012 (this,ADart );
53  case ORBIT_3: return new CDynamicCoverage3 (this,ADart );
54  case ORBIT_03: return new CDynamicCoverage03 (this,ADart );
55  case ORBIT_13: return new CDynamicCoverage13 (this,ADart );
56  case ORBIT_013: return new CDynamicCoverage013 (this,ADart );
57  case ORBIT_23: return new CDynamicCoverage23 (this,ADart );
58  case ORBIT_023: return new CDynamicCoverage023 (this,ADart );
59  case ORBIT_123: return new CDynamicCoverage123 (this,ADart );
60  case ORBIT_0123: return new CDynamicCoverage0123 (this,ADart );
61  case ORBIT_BORDER_0: return new CDynamicBorderCoverage(this,ADart,0);
62  case ORBIT_BORDER_1: return new CDynamicBorderCoverage(this,ADart,1);
63  case ORBIT_BORDER_2: return new CDynamicBorderCoverage(this,ADart,2);
64  case ORBIT_BORDER_3: return new CDynamicBorderCoverage(this,ADart,3);
65  }
66 
67  return NULL;
68 }
69 //******************************************************************************
70 INLINE
72 {
73  switch (AOrbit)
74  {
75  case ORBIT_SELF: return new CStaticCoverageSelf (this,ADart );
76  case ORBIT_0: return new CStaticCoverage0 (this,ADart );
77  case ORBIT_1: return new CStaticCoverage1 (this,ADart );
78  case ORBIT_01: return new CStaticCoverage01 (this,ADart );
79  case ORBIT_2: return new CStaticCoverage2 (this,ADart );
80  case ORBIT_02: return new CStaticCoverage02 (this,ADart );
81  case ORBIT_12: return new CStaticCoverage12 (this,ADart );
82  case ORBIT_012: return new CStaticCoverage012 (this,ADart );
83  case ORBIT_3: return new CStaticCoverage3 (this,ADart );
84  case ORBIT_03: return new CStaticCoverage03 (this,ADart );
85  case ORBIT_13: return new CStaticCoverage13 (this,ADart );
86  case ORBIT_013: return new CStaticCoverage013 (this,ADart );
87  case ORBIT_23: return new CStaticCoverage23 (this,ADart );
88  case ORBIT_023: return new CStaticCoverage023 (this,ADart );
89  case ORBIT_123: return new CStaticCoverage123 (this,ADart );
90  case ORBIT_0123: return new CStaticCoverage0123 (this,ADart );
91  case ORBIT_BORDER_0: return new CStaticBorderCoverage(this,ADart,0);
92  case ORBIT_BORDER_1: return new CStaticBorderCoverage(this,ADart,1);
93  case ORBIT_BORDER_2: return new CStaticBorderCoverage(this,ADart,2);
94  case ORBIT_BORDER_3: return new CStaticBorderCoverage(this,ADart,3);
95  }
96 
97  return NULL;
98 }
99 //******************************************************************************
100 INLINE
102  int AMarkNumber)
103 {
104  switch (AOrbit)
105  {
106  case ORBIT_012: return new CBasicDynamicCoverage012 (this,ADart ,
107  AMarkNumber);
108  case ORBIT_123: return new CBasicDynamicCoverage123 (this,ADart ,
109  AMarkNumber);
110  case ORBIT_0123: return new CBasicDynamicCoverage0123(this,ADart ,
111  AMarkNumber);
112  case ORBIT_BORDER_0: return new CBasicBorderCoverage (this,ADart,0,
113  AMarkNumber);
114  case ORBIT_BORDER_1: return new CBasicBorderCoverage (this,ADart,1,
115  AMarkNumber);
116  case ORBIT_BORDER_2: return new CBasicBorderCoverage (this,ADart,2,
117  AMarkNumber);
118  case ORBIT_BORDER_3: return new CBasicBorderCoverage (this,ADart,3,
119  AMarkNumber);
120  }
121 
122  return NULL;
123 }
124 //******************************************************************************
125 INLINE
127 {
128  switch (orbit)
129  {
130  case ORBIT_012: return new CMultiDynamicCoverage012 (this, D);
131  case ORBIT_123: return new CMultiDynamicCoverage123 (this, D);
132  case ORBIT_0123: return new CMultiDynamicCoverage0123(this, D);
133  }
134 
135  return NULL;
136 }
137 //******************************************************************************
138 INLINE
139 bool CGMap::isSameOrbit(CDart* ADart1, CDart* D2, TOrbit orbit)
140 {
141  bool found = false;
142 
143  CCoverage* C = getDynamicCoverage(ADart1,orbit);
144 
145  while (!found && C->cont())
146  if ((*C)++ == D2)
147  found = true;
148 
149  delete C;
150 
151  return found;
152 }
153 //******************************************************************************
154 INLINE
156 {
157  CCoverage* C = getDynamicCoverage(D, orbit);
158  CDart* res = NULL;
159  bool found = false;
160 
161  while (!found && C->cont())
162  {
163  if ((**C)->isOrbitUsed(orbit))
164  {
165  res = **C;
166  found = true;
167  }
168  else
169  ++ * C;
170  }
171 
172  delete C;
173 
174  return res;
175 }
176 //******************************************************************************
177 INLINE
179  TAttributeId typeAttr)
180 {
181  assert(isOrbitUsed(orbit));
182  CDart* Do = getEmbeddingOwner(D, orbit);
183 
184  if ( Do!=NULL )
185  return Do->getAttribute(orbit,typeAttr);
186 
187  return NULL;
188 }
189 //******************************************************************************
190 INLINE
192 {
193  assert(isOrbitUsed(orbit));
194  CDart* Do = getEmbeddingOwner(D,orbit);
195 
196  if ( Do==NULL )
197  Do = D;
198 
199  Do->addAttribute(orbit,A);
200 }
201 //******************************************************************************
202 INLINE
204  TAttributeId typeAttr)
205 {
206  assert(isOrbitUsed(orbit));
207 
208  CDart* Do = getEmbeddingOwner(D,orbit);
209 
210  if (Do!=NULL)
211  return Do->removeAttribute(orbit,typeAttr);
212 
213  return NULL;
214 }
215 //******************************************************************************
216 INLINE
218 {
219  delete removeAttribute(D, orbit, typeAttr);
220 }
221 //******************************************************************************
222 INLINE
223 bool CGMap::isSameOrbit(CDart* ADart1, CDart* ADart2, TOrbit AOrbit,
224  CDart*& ADartEmbeddingOwner1)
225 {
226  CCoverage * cov = getDynamicCoverage(ADart1, AOrbit);
227  ADartEmbeddingOwner1 = NULL;
228  bool found = false;
229 
230  while (!found && cov->cont())
231  {
232  if (**cov == ADart2)
233  found = true;
234 
235  if ((**cov)->isOrbitUsed(AOrbit))
236  ADartEmbeddingOwner1 = **cov;
237 
238  ++ *cov;
239  }
240 
241  delete cov;
242  return found;
243 }
244 //******************************************************************************
245 INLINE
246 bool CGMap::isValidOrbit(CDart* ADart, TOrbit AOrbit)
247 {
248  for (int i=0; i<2; ++i)
249  for (int j=i+2; j<4; ++j)
250  if ((AOrbit & ORBIT_DIM[i]) && (AOrbit & ORBIT_DIM[j]) &&
251  alpha(alpha(ADart, i), j) != alpha(alpha(ADart, j), i))
252  return false;
253 
254  return true;
255 }
256 //******************************************************************************
257 INLINE
258 void CGMap::groupAttributes(CDart* ADart1, CDart* D2, TMask16 AMask)
259 {
260  TOrbit i,j;
261 
262  CDart* d1;
263  CDart* d2;
264 
265  for (i = ORBIT_0; i <= ORBIT_0123; ++i) // pour chaque orbite
266  if (AMask[i] && isOrbitUsed(i) && isValidOrbit(ADart1, i))
267  {
268  if (isSameOrbit(ADart1, D2, i, d1)) // même orbite => rien a grouper
269  for (j = i+1; j <= ORBIT_0123; ++j)
270  {
271  if (IS_ORBIT_INCLUDED(i,j)) // l'orbite i incluse dans l'orbite j
272  AMask.set(j,false);
273  }
274  else
275  { // ADart1 et D2 dans deux orbites différentes => il faut grouper
276  d2 = getEmbeddingOwner(D2,i);
277 
278  if (d1!=NULL && d2!=NULL) // les 2 brins portent un embedding
279  { // 1) on enleve l'embedding de d1 pour <orbit>
280  CEmbedding *E = d1->removeEmbedding(i);
281  assert(E!=NULL);
282  // 2) puis d2 récupère de E les attributs qu'il n'a pas
283  d2->mergeEmbedding(E);
284  // 3) on détruit E (et les éventuels attributs restés)
285  E->destroy();
286  }
287  }
288  }
289 }
290 //******************************************************************************
291 INLINE
292 void CGMap::duplicateAttributes(CDart* ADart1, CDart* D2, TMask16 AMask)
293 {
294  TOrbit i,j;
295  CDart* d1;
296 
297  for (i = ORBIT_0; i <= ORBIT_0123; ++i) // pour chaque orbite
298  if (AMask[i] && isOrbitUsed(i) && isValidOrbit(ADart1, i))
299  {
300  if (isSameOrbit(ADart1, D2, i, d1)) // même orbite => rien a dégrouper
301  {
302  for (j = i+1; j <= ORBIT_0123; ++j)
303  if (IS_ORBIT_INCLUDED(i,j))
304  AMask.set(j,false);
305  }
306  else
307  { // ADart1 et D2 dans deux orbites différentes => il faut dégrouper
308  if (d1==NULL) // le brin ADart1 n'a pas d'embedding pour <i>
309  {
310  d1 = getEmbeddingOwner(D2,i);
311  if (d1!=NULL) // si D2 en a un, on le duplique pour ADart1
312  ADart1->addEmbedding((d1->getEmbedding(i))->copy());
313  }
314  else
315  { // Ici, d1!=NULL donc forcément D2 n'a pas d'embedding
316  // et on va lui en rajouter un (la copie de celui de d1).
317  assert(getEmbeddingOwner(D2,i)==NULL);
318  D2->addEmbedding((d1->getEmbedding(i))->copy());
319  }
320  }
321  }
322 }
323 //******************************************************************************
324 INLINE
325 bool CGMap::canSew0(CDart* d1, CDart* d2)
326 {
327  assert(d1!=NULL && d2!=NULL);
328  return canSew(d1,d2, 0);
329 }
330 //******************************************************************************
331 INLINE
332 bool CGMap::canSew1(CDart* d1, CDart* d2)
333 {
334  assert(d1!=NULL && d2!=NULL);
335  return canSew(d1,d2, 1);
336 }
337 //******************************************************************************
338 INLINE
339 bool CGMap::canSew2(CDart* d1, CDart* d2)
340 {
341  assert(d1!=NULL && d2!=NULL);
342  return canSew(d1,d2, 2);
343 }
344 //******************************************************************************
345 INLINE
346 bool CGMap::canSew3(CDart* d1, CDart* d2)
347 {
348  return canSew(d1,d2, 3);
349 }
350 //******************************************************************************
351 INLINE
352 bool CGMap::canSew(CDart* d1, CDart* d2, int i)
353 {
354  assert(d1!=NULL && d2!=NULL);
355 
356  if ( d1==d2 || !isFree(d1,i) || !isFree(d2,i) )
357  return false;
358 
359  CCoverage* cov1 = getDynamicCoverage(d1, ORBIT_INVO[i]);
360  CCoverage* cov2 = getDynamicCoverage(d2, ORBIT_INVO[i]);
361 
362  while (cov1->cont() && cov2->cont() &&
363  cov1->prevOperationType()==cov2->prevOperationType())
364  {
365  ++(*cov1);
366  ++(*cov2);
367  }
368 
369  bool ok = !cov1->cont() && !cov2->cont();
370 
371  delete cov1;
372  delete cov2;
373 
374  return ok;
375 }
376 //******************************************************************************
377 INLINE
378 void CGMap::dartSew0(CDart* ADart1, CDart* ADart2)
379 {
380  groupAttributes(ADart1,ADart2,MASK0);
381  linkAlpha0(ADart1,ADart2);
382 }
383 //******************************************************************************
384 INLINE
385 void CGMap::dartSew1(CDart* ADart1, CDart* ADart2)
386 {
387  groupAttributes(ADart1,ADart2,MASK1);
388  linkAlpha1(ADart1,ADart2);
389 }
390 //******************************************************************************
391 INLINE
392 void CGMap::dartSew2(CDart* ADart1, CDart* ADart2)
393 {
394  groupAttributes(ADart1,ADart2,MASK2);
395  linkAlpha2(ADart1,ADart2);
396 }
397 //******************************************************************************
398 INLINE
399 void CGMap::dartSew3(CDart* ADart1, CDart* ADart2)
400 {
401  groupAttributes(ADart1,ADart2,MASK3);
402  linkAlpha3(ADart1,ADart2);
403 }
404 //******************************************************************************
405 INLINE
406 void CGMap::dartSew(CDart* ADart1, CDart* ADart2, int ADimension)
407 {
408  switch(ADimension)
409  {
410  case 0: dartSew0(ADart1, ADart2); break;
411  case 1: dartSew1(ADart1, ADart2); break;
412  case 2: dartSew2(ADart1, ADart2); break;
413  case 3: dartSew3(ADart1, ADart2); break;
414  }
415 }
416 //******************************************************************************
417 INLINE
419 {
420  assert(ADart!=NULL);
421  assert(!isFree0(ADart));
422 
423  CDart* D2 = alpha0(ADart);
424  unlinkAlpha0(ADart);
425  duplicateAttributes(ADart,D2,MASK0);
426 }
427 //******************************************************************************
428 INLINE
430 {
431  assert(ADart!=NULL);
432  assert(!isFree1(ADart));
433 
434  CDart* D2 = alpha1(ADart);
435  unlinkAlpha1(ADart);
436  duplicateAttributes(ADart,D2,MASK1);
437 }
438 //******************************************************************************
439 INLINE
441 {
442  assert(ADart!=NULL);
443  assert(!isFree2(ADart));
444 
445  CDart* D2 = alpha2(ADart);
446  unlinkAlpha2(ADart);
447  duplicateAttributes(ADart,D2,MASK2);
448 }
449 //******************************************************************************
450 INLINE
452 {
453  assert(ADart!=NULL);
454  assert(!isFree3(ADart));
455 
456  CDart* D2 = alpha3(ADart);
457  unlinkAlpha3(ADart);
458  duplicateAttributes(ADart,D2,MASK3);
459 }
460 //******************************************************************************
461 INLINE
462 void CGMap::dartUnsew(CDart* ADart, int ADimension)
463 {
464  switch(ADimension)
465  {
466  case 0: dartUnsew0(ADart); break;
467  case 1: dartUnsew1(ADart); break;
468  case 2: dartUnsew2(ADart); break;
469  case 3: dartUnsew3(ADart); break;
470  }
471 }
472 //******************************************************************************
473 INLINE
474 void CGMap::topoSew0(CDart* ADart1, CDart* ADart2)
475 {
476  assert(canSew0(ADart1,ADart2));
477 
478  CDynamicCoverage23 I1(this,ADart1);
479  CDynamicCoverage23 I2(this,ADart2);
480 
481  while (I1.cont()) // on ne teste pas I2.cont() grâce à l'assert.
482  linkAlpha0(I1++,I2++);
483 }
484 //******************************************************************************
485 INLINE
486 void CGMap::topoSew1(CDart* ADart1, CDart* ADart2)
487 {
488  assert(canSew1(ADart1,ADart2));
489 
490  linkAlpha1(ADart1,ADart2);
491 
492  if (!isFree3(ADart1))
493  linkAlpha1(alpha3(ADart1),alpha3(ADart2));
494 }
495 //******************************************************************************
496 INLINE
497 void CGMap::topoSew2(CDart* ADart1, CDart* ADart2)
498 {
499  assert(canSew2(ADart1,ADart2));
500 
501  linkAlpha2(ADart1,ADart2);
502 
503  if (!isFree0(ADart1))
504  linkAlpha2(alpha0(ADart1),alpha0(ADart2));
505 }
506 //******************************************************************************
507 //
508 INLINE
509 void CGMap::topoSew3(CDart* ADart1, CDart* ADart2)
510 {
511  assert(canSew3(ADart1,ADart2));
512 
513  CDynamicCoverage01 I1(this, ADart1);
514  CDynamicCoverage01 I2(this, ADart2);
515 
516  while( I1.cont() ) // on ne teste pas I2.cont() grâce à l'assert.
517  linkAlpha3(I1++,I2++);
518 }
519 //******************************************************************************
520 INLINE
521 void CGMap::topoSew(CDart* ADart1, CDart* ADart2, int ADimension)
522 {
523  switch(ADimension)
524  {
525  case 0: topoSew0(ADart1, ADart2); break;
526  case 1: topoSew1(ADart1, ADart2); break;
527  case 2: topoSew2(ADart1, ADart2); break;
528  case 3: topoSew3(ADart1, ADart2); break;
529  }
530 }
531 //******************************************************************************
532 INLINE
534 {
535  assert(!isFree0(ADart));
536 
537  CDynamicCoverage23 I(this,ADart);
538  while (I.cont())
539  unlinkAlpha0(I++);
540 }
541 //******************************************************************************
542 INLINE
544 {
545  assert(!isFree1(ADart));
546 
547  unlinkAlpha1(ADart);
548  if (!isFree3(ADart))
549  unlinkAlpha1(alpha3(ADart));
550 }
551 //******************************************************************************
552 INLINE
554 {
555  assert(!isFree2(ADart));
556 
557  unlinkAlpha2(ADart);
558  if (!isFree0(ADart))
559  unlinkAlpha2(alpha0(ADart));
560 }
561 //******************************************************************************
562 INLINE
564 {
565  assert(!isFree3(ADart));
566 
567  CDynamicCoverage01 I(this, ADart);
568  while (I.cont())
569  unlinkAlpha3(I++);
570 }
571 //******************************************************************************
572 INLINE
573 void CGMap::topoUnsew(CDart* ADart, int ADimension)
574 {
575  switch(ADimension)
576  {
577  case 0: topoUnsew0(ADart); break;
578  case 1: topoUnsew1(ADart); break;
579  case 2: topoUnsew2(ADart); break;
580  case 3: topoUnsew3(ADart); break;
581  }
582 }
583 //******************************************************************************
584 INLINE
585 void CGMap::sew0(CDart* ADart1, CDart* ADart2)
586 {
587  assert(canSew0(ADart1,ADart2));
588 
589  CDynamicCoverage23 I1(this, ADart1);
590  CDynamicCoverage23 I2(this, ADart2);
591 
592  CDart*d1 = I1++;
593  CDart*d2 = I2++;
594 
595  groupAttributes(d1,d2,MASK0);
596  linkAlpha(d1,d2,0);
597 
598  while (I1.cont()) // on ne teste pas I2.cont() grâce à l'assert.
599  {
600  d1 = *I1; d2 = *I2;
601 
602 
603  if (I1.prevOperationType() == OP_ALPHAI)
604  {
605  // Le précédent ++ à réalisé un alpha2, donc on teste
606  // uniquement les orbites contenant 0 mais pas 2
607  groupAttributes(d1,d2,MASK0M2);
608  }
609  else
610  {
611  // Ici, le précédent ++ à réalisé un alpha3 ou un jump, donc on teste
612  // uniquement les orbites contenant 0 mais pas 3.
613  groupAttributes(d1,d2,MASK0M3);
614  }
615 
616  linkAlpha(d1,d2,0);
617 
618  ++I1; ++I2;
619  }
620 }
621 
622 //******************************************************************************
623 INLINE
624 void CGMap::sew1(CDart* ADart1, CDart* ADart2)
625 {
626  assert(canSew1(ADart1,ADart2));
627 
628  groupAttributes(ADart1,ADart2,MASK1);
629  linkAlpha(ADart1,ADart2, 1);
630 
631  if (!isFree3(ADart1))
632  {
633  // Ici on a déjà groupé les orbites contenant 1 et 3, donc on regarde
634  // uniquement celles contenant 1 mais pas 3.
635  groupAttributes(alpha3(ADart1),alpha3(ADart2), MASK1M3);
636  linkAlpha(alpha3(ADart1),alpha3(ADart2), 1);
637  }
638 }
639 //******************************************************************************
640 INLINE
641 void CGMap::sew2(CDart* ADart1, CDart* ADart2)
642 {
643  assert(canSew2(ADart1,ADart2));
644 
645  groupAttributes(ADart1,ADart2, MASK2);
646  linkAlpha(ADart1,ADart2, 2);
647 
648  if (!isFree0(ADart1))
649  {
650  // Ici on a déjà groupé les orbites contenant 2 et 0, donc on regarde
651  // uniquement celles contenant 2 mais pas 0.
652  groupAttributes(alpha0(ADart1),alpha0(ADart2), MASK2M0);
653  linkAlpha(alpha0(ADart1),alpha0(ADart2), 2);
654  }
655 }
656 
657 //******************************************************************************
658 INLINE
659 void CGMap::sew3(CDart* ADart1, CDart* ADart2)
660 {
661  assert(canSew3(ADart1,ADart2));
662 
663  CDynamicCoverage01 I1(this, ADart1);
664  CDynamicCoverage01 I2(this, ADart2);
665 
666  CDart* d1 = I1++;
667  CDart* d2 = I2++;
668 
669  groupAttributes(d1,d2, MASK3);
670  linkAlpha(d1,d2, 3);
671 
672  while(I1.cont()) // on ne teste pas I2.cont() grâce à l'assert.
673  {
674  d1 = *I1;
675  d2 = *I2;
676 
677  if (I1.prevOperationType()==OP_ALPHAI)
678  {
679  // Le précédent ++ à réalisé un alpha0, donc on teste
680  // uniquement les orbites contenant 3 mais pas 0
681  groupAttributes(d1,d2, MASK3M0);
682  }
683  else
684  {
685  // Ici, le précédent ++ à réalisé un alpha1 ou un jump, donc on teste
686  // uniquement les orbites contenant 3 mais pas 1.
687  groupAttributes(d1,d2, MASK3M1);
688  }
689 
690  linkAlpha(d1,d2,3);
691  ++I1; ++I2;
692  }
693 }
694 
695 //******************************************************************************
696 //
697 INLINE
698 void CGMap::sew(CDart* ADart1, CDart* ADart2, int ADimension)
699 {
700  switch(ADimension)
701  {
702  case 0: sew0(ADart1, ADart2); break;
703  case 1: sew1(ADart1, ADart2); break;
704  case 2: sew2(ADart1, ADart2); break;
705  case 3: sew3(ADart1, ADart2); break;
706  }
707 }
708 
709 //******************************************************************************
710 INLINE
711 void CGMap::unsew0(CDart* ADart)
712 {
713  assert(!isFree0(ADart));
714 
715  CDart* d1 = NULL;
716  CDart* d2 = NULL;
717  bool prevai;
718  CDynamicCoverage23 It(this, ADart);
719 
720  while(It.cont())
721  {
722  d1 = *It; d2 = alpha0(d1);
723  unlinkAlpha0(d1);
724  prevai = (It.prevOperationType()==OP_ALPHAI);
725  ++It;
726 
727  if (It.cont())
728  {
729  if (prevai)
730  {
731  // Le précédent ++ à réalisé un alpha2, donc on teste
732  // uniquement les orbites contenant 0 mais pas 3
733  duplicateAttributes(d1,d2,MASK0M3);
734  }
735  else
736  {
737  // Ici, le précédent ++ à réalisé un alpha3 ou un jump, donc on
738  // teste uniquement les orbites contenant 0 mais pas 3.
739  duplicateAttributes(d1,d2,MASK0M2);
740  }
741  }
742  }
743 
744  duplicateAttributes(d1,d2,MASK0);
745 
746  // Version sure, ou on teste toujours toutes les orbites.
747  // CDynamicCoverage23 I(this,ADart);
748  // while( I.cont() )
749  // dartUnsew0(I++);
750 }
751 //******************************************************************************
752 INLINE
753 void CGMap::unsew1(CDart* ADart)
754 {
755  assert(!isFree1(ADart));
756 
757  CDart* D2 = alpha1(ADart);
758  unlinkAlpha1(ADart);
759 
760  if (!isFree3(ADart))
761  {
762  duplicateAttributes(ADart,D2,MASK1M3);
763  ADart = alpha3(ADart); D2 = alpha1(ADart);
764  unlinkAlpha1(ADart);
765  }
766 
767  duplicateAttributes(ADart,D2, MASK1);
768 
769  // Version sure, où on teste toujours toutes les orbites
770  // dartUnsew1(ADart);
771  // if (!isFree3(ADart)) dartUnsew1(alpha3(ADart));
772 }
773 
774 //******************************************************************************
775 INLINE
776 void CGMap::unsew2(CDart* ADart)
777 {
778  assert(!isFree2(ADart));
779 
780  CDart* D2 = alpha2(ADart);
781  unlinkAlpha2(ADart);
782 
783  if (!isFree0(ADart))
784  {
785  duplicateAttributes(ADart,D2,MASK2M0);
786  ADart = alpha0(ADart); D2 = alpha2(ADart);
787  unlinkAlpha2(ADart);
788  }
789 
790  duplicateAttributes(ADart,D2,MASK2);
791 
792  // Version sure, ou on teste toujours toutes les orbites
793  // dartUnsew2(ADart);
794  // if (!isFree0(ADart)) dartUnsew2(alpha0(ADart));
795 }
796 
797 //******************************************************************************
798 INLINE
799 void CGMap::unsew3(CDart* ADart)
800 {
801  assert(!isFree3(ADart));
802 
803  CDart* d1 = NULL;
804  CDart* d2 = NULL;
805  bool prevai;
806  CDynamicCoverage01 It(this, ADart);
807 
808  while(It.cont())
809  {
810  d1 = *It; d2 = alpha3(d1);
811  unlinkAlpha3(d1);
812  prevai = (It.prevOperationType()==OP_ALPHAI);
813  ++It;
814  if (It.cont())
815  {
816  if (prevai)
817  {
818  // Le précédent ++ à réalisé un alpha0, donc on teste
819  // uniquement les orbites contenant 3 mais pas 1.
820  duplicateAttributes(d1,d2,MASK3M1);
821  }
822  else
823  {
824  // Ici, le précédent ++ à réalisé un alpha1 ou un jump, donc on
825  // testeuniquement les orbites contenant 3 mais pas 0
826  duplicateAttributes(d1,d2,MASK3M0);
827  }
828  }
829  }
830 
831  duplicateAttributes(d1,d2,MASK3);
832 
833  // // Version sure, ou on teste toujours toutes les orbites.
834  // CDynamicCoverage01 I(this, ADart);
835  // while (I.cont())
836  // dartUnsew3(I++);
837 }
838 //******************************************************************************
839 INLINE
840 void CGMap::unsew(CDart* ADart,int ADimension)
841 {
842  switch(ADimension)
843  {
844  case 0: unsew0(ADart); break;
845  case 1: unsew1(ADart); break;
846  case 2: unsew2(ADart); break;
847  case 3: unsew3(ADart); break;
848  }
849 }
850 //******************************************************************************
851 } // namespace GMap3d
852 //******************************************************************************