27 using namespace GMap3d;
33 bool closed = !isFree0(ADart);
34 int treated = getNewMark();
38 for (; it.
cont(); setMark(*it, treated), ++it)
40 CDart * d0 = alpha0(*it);
45 if (closed) linkAlpha0(d0 , n2);
49 if (!isFree2(*it) && isMarked(alpha2(*it), treated))
55 if (!isFree3(*it) && isMarked(alpha3(*it), treated))
72 int treated = getNewMark();
74 for (; it.
cont(); ++it)
75 if (!isMarked(*it, treated))
77 if (isMarked(*it, AMarkNumber))
86 setMark(*it, treated);
89 negateMaskMark(treated);
97 assert(ADart1!=NULL && ADart2!=NULL);
105 CDart * dd1 = isFree1(ADart1) ? NULL : alpha1(ADart1);
106 CDart * dd2 = isFree1(ADart2) ? NULL : alpha1(ADart2);
108 linkAlpha1(ADart1,n1); linkAlpha1(ADart2,n2);
110 if (dd1!=NULL || dd2!=NULL)
116 linkAlpha2(n1,nn1); linkAlpha2(n2,nn2);
118 if (dd1!=NULL) linkAlpha1(dd1,nn1);
119 if (dd2!=NULL) linkAlpha1(dd2,nn2);
123 if (!isFree3(ADart1))
127 linkAlpha3(n1,alpha1(ADart1)); linkAlpha3(n2,alpha1(ADart2));
129 if (dd1!=NULL) unlinkAlpha1(alpha3(ADart1));
130 if (dd2!=NULL) unlinkAlpha1(alpha3(ADart2));
132 linkAlpha1(n1,alpha3(ADart1)); linkAlpha1(n2,alpha3(ADart2));
133 if (dd1!=NULL || dd2!=NULL)
139 linkAlpha2(n1,nn1); linkAlpha2(n2,nn2);
141 if (dd1!=NULL) linkAlpha1(alpha3(dd1),nn1);
142 if (dd2!=NULL) linkAlpha1(alpha3(dd2),nn2);
144 linkAlpha3(alpha1(dd1),nn1); linkAlpha3(alpha1(dd2),nn2);
148 return alpha1(ADart1);
157 int treated = getNewMark();
158 int mark = getNewMark();
160 for (; it.
cont(); ++it)
161 if (!isMarked(*it, treated))
163 if (!isMarked(*it, AMarkNumber))
164 setMark(*it, treated);
171 bool canInsert =
true;
172 CDart * d1 = NULL, * d2 = NULL;
176 for (; cov.
cont() && canInsert; ++cov)
177 if (isMarked(*cov, AMarkNumber) && !isMarked(*cov, mark))
193 canInsert &= (d2!=NULL);
195 if (canInsert && ANoCrossedFace && !isSameOrbit(d1,d2,
ORBIT_01))
211 negateMaskMark(treated);
218 #define IS_MARKED_EDGE(D) \
220 isMarked(D, AMarkNumber) || isMarked(alpha0(D), AMarkNumber) || \
222 ANoCrossedVolume && !isFree2(D) && \
223 (isMarked(alpha2(D), AMarkNumber) || isMarked(alpha20(D), AMarkNumber)) \
227 #define IS_VALID_EDGE(D) \
228 (ANoCrossedVolume || isFree2(D) || \
229 (!isMarked( D , AMarkNumber) && !isMarked(alpha0 (D), AMarkNumber)) || \
230 (!isMarked(alpha2(D), AMarkNumber) && !isMarked(alpha02(D), AMarkNumber)))
232 #define IS_ON_SAME_EDGE(D1,D2) \
233 ((D1)==(D2) || (ANoCrossedVolume && ((D1)==alpha2(D2))))
238 CDart * & ANext,
bool & ACrossed)
243 bool firstDirection =
true;
244 bool validVertex =
true;
250 if (cov.prevOperationType() ==
OP_JUMP)
251 firstDirection =
false;
261 cov.prevOperationType() ==
267 ANext = alpha2(*cov);
281 bool ANoCrossedVolume,
282 bool ANoTwoEdgesFace,
283 bool ANoTwoFacesVolume)
286 assert(isMarked(ADart, AMarkNumber));
293 CDart * current = ADart;
296 bool firstDirection =
true;
297 bool finished =
false;
299 bool sameFace[2] = {
true,
true };
303 while (canInsert && !finished)
318 sameFace[crossed ? 1 : 0] && isSameOrbit(alpha1 (next), current,
ORBIT_2);
321 sameFace[crossed ? 0 : 1] && isSameOrbit(
alpha21(next), current,
ORBIT_2);
326 if (next==NULL || isFree0(next))
329 finished = !firstDirection || isFree0(ADart);
330 firstDirection =
false;
331 current = alpha0(ADart);
336 current = alpha0(next);
345 bool enoughEdges = !ANoTwoEdgesFace || nbVertices >= (firstDirection ? 3 : 2);
346 bool enoughFaces = !ANoTwoFacesVolume || (!sameFace[0] && !sameFace[1]);
348 return canInsert && enoughEdges && enoughFaces;
352 bool ANoCrossedVolume)
358 bool firstDirection = true ;
359 bool finished =
false;
360 bool turnedAround =
false;
363 CDart * prev = NULL, * current = ADart, * next;
369 assert(!turnedAround || !jumped);
377 next = isFree0(current) ? NULL : alpha0(current);
384 AMarkNumber, next, crossed);
386 if (next!=NULL && crossed && ANoCrossedVolume)
388 assert(!isFree2(current));
389 current = alpha2(current);
392 assert(!isFree2(prev));
399 CDart * d1 = current;
400 CDart * d2 = isFree2(d1) ? NULL : alpha2(d1);
415 linkAlpha1(alpha2 (d1), alpha2 (prev));
429 finished = !firstDirection || isFree0(ADart);
430 firstDirection =
false;
431 turnedAround =
false;
434 current = alpha0(ADart);
441 prev = current; jumped = turnedAround;
442 current = next ; turnedAround = !turnedAround;
449 assert(!isFree2(next));
450 linkAlpha0(alpha2 (ADart),
alpha02 (ADart));
454 return alpha2(ADart);
457 #undef IS_ON_SAME_EDGE
459 #undef IS_MARKED_EDGE
462 bool ANoCrossedVolume,
463 bool ANoTwoEdgesFace,
464 bool ANoTwoFacesVolume)
468 int treated = getNewMark();
470 for (; it.
cont(); ++it)
471 if (!isMarked(*it, treated))
473 if (isMarked(*it, AMarkNumber))
476 stack<CDart *> toTreat; toTreat.push(*it);
478 while (!toTreat.empty())
480 CDart * dart = toTreat.top(); toTreat.pop();
483 if (!isMarked(*cov, treated))
485 if (!isFree0(*cov) && !isMarked(alpha0(*cov), treated) &&
486 (isMarked(*cov, AMarkNumber) ||
487 isMarked(alpha0(*cov), AMarkNumber)))
488 toTreat.push(alpha0(*cov));
490 setMark( *cov , treated);
491 setMark(alpha2(*cov), treated);
497 ANoTwoEdgesFace, ANoTwoFacesVolume))
506 setMark(*it, treated);
509 negateMaskMark(treated);