26 #include "g-map-generic.hh"
27 using namespace GMap3d;
29 #define SIDE(DART) ((((CGMapGeneric*) FMap)->*side)(DART))
30 #define TURN(DART) ((((CGMapGeneric*) FMap)->*turn)(DART))
31 #define SUCC(DART) ((((CGMapGeneric*) FMap)->*succ)(DART))
45 for (CDynamicCoverage01 cov(FMap, ADart); n<ASx && cov.cont(); ++cov)
47 if (FMap->isFree0(*cov))
52 CDynamicCoverage23 covDart (FMap, *cov );
53 CDynamicCoverage23 covModel(FMap, AModel);
55 while (covDart.cont() && covModel.cont() &&
56 covDart.prevOperationType()==covModel.prevOperationType())
62 if (covDart.cont() || covModel.cont())
69 if (n<ASx && FMap->isFree1(*cov))
79 assert(ADim>=0 && ADim<=1);
96 bool ACheck3Sews,
bool A3Sewed)
102 if (ACheck3Sews && A3Sewed==FMap->isFree3(ADart))
106 int nbToObtain = 4*(ASx+ASy);
108 for (CDynamicCoverage01 cov(FMap, ADart); cov.cont(); ++cov)
110 if (FMap->isFree0(*cov) || FMap->isFree1(*cov))
113 if (++nbDarts > nbToObtain)
117 return nbDarts == nbToObtain;
121 bool ACheck3Sews,
bool A3Sewed)
131 bool ACheck3Sews,
bool A3Sewed)
141 bool ACheck3Sews,
bool A3Sewed)
143 assert(ADim>=0 && ADim<=3);
156 CDart* (CGMapGeneric::* succ) (CDart*)
const
157 = ADim==2 ? & CGMapGeneric::alpha0121 : & CGMapGeneric::alpha012321;
159 CDart* (CGMapGeneric::* side) (CDart*)
const
160 = ADim==2 ? & CGMapGeneric::alpha01 : & CGMapGeneric::alpha012;
162 CDart* (CGMapGeneric::* turn) (CDart*)
const
163 = ADim==2 ? & CGMapGeneric::alpha12 : & CGMapGeneric::alpha1232;
165 CDart* currentX = ADart;
167 for (
int i=0; i<ASx; ++i)
169 CDart* currentY = FMap->alpha1(currentX);
171 for (
int j=0; j<ASy; ++j)
177 if (FMap->isFree(
SIDE(FMap->alpha1(currentY)), ADim))
181 if (FMap->isFree(
SIDE( currentY ), ADim))
186 CDart* tmp = currentY;
188 for (
int k=0; k<4; ++k)
192 if ((k!=3 && tmp==currentY) || (k==3 && tmp!=currentY))
198 currentY =
SUCC(currentY);
202 currentX =
SUCC(currentX);
210 int AMarkNumberNotX1,
211 int AMarkNumberNotX2,
212 int AMarkNumberNotY1,
213 int AMarkNumberNotY2,
215 CDart** AOppositeDart)
217 assert(ADim>=0 && ADim<=2);
222 assert(AMarkNumberNotX1>0);
223 assert(AMarkNumberNotY1>0);
224 assert(AReturnedDart>=1 && AReturnedDart<=3);
229 CDart* (CGMapGeneric::* succ) (CDart*)
const
230 = ADim<2 ? & CGMapGeneric::alpha01 : & CGMapGeneric::alpha0121;
232 CDart* current = ADart;
234 for (
int round=0; round<2; ++round)
236 for (
int i=0; i<ASx; ++i)
238 if (FMap->isMarked(current, AMarkNumberNotX1) ||
239 (AMarkNumberNotX2>=0 &&
240 FMap->isMarked(current, AMarkNumberNotX2)))
243 if (FMap->isMarked(FMap->alpha0(current), AMarkNumberNotX1) ||
244 (AMarkNumberNotX2>=0 &&
245 FMap->isMarked(FMap->alpha0(current), AMarkNumberNotX2)))
249 current =
SUCC(current);
252 current = FMap->alpha0(current);
254 if (AOppositeDart!=NULL)
256 if (round==0 && AReturnedDart==1)
257 * AOppositeDart = current;
259 if (round==1 && AReturnedDart==2)
260 * AOppositeDart = current;
263 current = FMap->alpha1(current);
265 for (
int j=0; j<ASy; ++j)
267 if (FMap->isMarked(current, AMarkNumberNotY1) ||
268 (AMarkNumberNotY2>=0 &&
269 FMap->isMarked(current, AMarkNumberNotY2)))
272 if (FMap->isMarked(FMap->alpha0(current), AMarkNumberNotY1) ||
273 (AMarkNumberNotY2>=0 &&
274 FMap->isMarked(FMap->alpha0(current), AMarkNumberNotY2)))
278 current =
SUCC(current);
281 current = FMap->alpha01(current);
283 if (AOppositeDart!=NULL)
285 if (round==0 && AReturnedDart==3)
286 * AOppositeDart = current;
294 CDart* ADart1, CDart* ADart2,
297 assert(ADim==1 || ADim==2);
298 assert(ADart1!=NULL);
299 assert(ADart2!=NULL);
301 CDart* (CGMapGeneric::* succ) (CDart*)
const
302 = ADim==1 ? & CGMapGeneric::alpha01 : & CGMapGeneric::alpha0121;
304 CDart* current1 = ADart1;
305 CDart* current2 = ADart2;
307 for (
int i=0; i<AS; ++i)
309 if (FMap->alpha2(current1)!=current2)
314 current1 =
SUCC(current1);
315 current2 =
SUCC(current2);
319 return FMap->alpha0(current1);
356 CDart* currentX = ADart;
358 for (
int i=0; i<ASx; ++i)
360 CDart* currentY = FMap->alpha12(currentX);
362 for (
int j=0; j<ASy; ++j)
364 CDart* currentZ = FMap->alpha12(currentY);
366 for (
int k=0; k<ASz; ++k)
373 currentZ = FMap->alpha012(currentZ);
375 if (FMap->isFree3(currentZ))
378 currentZ = FMap->alpha321(currentZ);
384 currentY = FMap->alpha012(currentY);
386 if (FMap->isFree3(currentY))
389 currentY = FMap->alpha321(currentY);
395 currentX = FMap->alpha012(currentX);
397 if (FMap->isFree3(currentX))
400 currentX = FMap->alpha321(currentX);
408 CDart* ADart,
int ASx,
int ASy,
int ASz)
410 assert(ADim>=0 && ADim<=3);
419 CDart* current = ADart;
430 int len = i%2 == 0 ? ASx : ASy;
433 if (FMap->isFree2(current) ||
439 FMap->alpha2(current), len);
444 current = FMap->alpha1(current);
449 if (FMap->degree(memo[i], 0, 3) != 3)
455 memo[i] = FMap->alpha21(memo[i]);
457 if (FMap->isFree2(memo[i]))
461 FMap->alpha2(memo[i]), ASz);
463 if (memo[i]==NULL || FMap->isFree2(FMap->alpha1(memo[i])))
466 memo[i] = FMap->alpha12(memo[i]);
475 if (FMap->degree(memo[i], 0, 3) != 3)
481 int len = i%2 == 0 ? ASx : ASy;
484 FMap->alpha2(memo[i]), len) == NULL)
492 int ASx,
int ASy,
int ASz,
493 int AMarkNumberNotX1,
494 int AMarkNumberNotX2,
495 int AMarkNumberNotY1,
496 int AMarkNumberNotY2,
497 int AMarkNumberNotZ1,
498 int AMarkNumberNotZ2)
500 assert(ADim>=0 && ADim<=3);
506 assert(AMarkNumberNotX1>0);
507 assert(AMarkNumberNotY1>0);
508 assert(AMarkNumberNotZ1>0);
513 int s[3] = { ASx, ASy, ASz };
516 { AMarkNumberNotX1, AMarkNumberNotX2 },
517 { AMarkNumberNotY1, AMarkNumberNotY2 },
518 { AMarkNumberNotZ1, AMarkNumberNotZ2 },
521 CDart* current = ADart;
523 for (
int dim=0; dim<3; ++dim)
528 m[dim][0], m[dim][1],
529 m[(dim+1)%3][0], m[(dim+1)%3][1],
534 s[(dim+1)%3], s[(dim+2)%3],
535 m[(dim+1)%3][0], m[(dim+1)%3][1],
536 m[(dim+2)%3][0], m[(dim+2)%3][1]))
539 current = FMap->alpha12(current);