27 using namespace GMap3d;
30 bool AExtrusionWithAdjacentSews,
32 int AMarkToExtrude,
int AMarkExtruded)
41 AExtrusionWithAdjacentSews,
51 for (; cov1->
cont(); ++(*cov1), ++(*cov2))
54 markOrbit(**cov1, orbitPieceOfVertex, treated);
60 if (AExtrusionWithAdjacentSews && ADim==2)
61 vector = AExtrusionCoef *
112 bool AExtrusionWithAdjacentSews,
113 bool ARotateExtrudedCells,
114 bool AScaleExtrudedCells,
115 CDart* APonderationPath,
117 int ADirectInfoIndex)
131 AExtrusionWithAdjacentSews,
132 AMarkExtruded, ADirectInfoIndex);
134 CDart* current = change ?
alpha(ADart, ADim+1) : ADart;
138 int pathInitialPos = 0;
142 CDart* current = APath;
153 if (APonderationPath!=NULL)
159 APonderationPath =
alpha10(APonderationPath);
173 assert(i==ponderationNbVertices);
178 for (
int pathI=0; pathI<pathNbVertices; ++pathI)
179 if (ponderationNbVertices==1)
180 pathCoefs[pathI] = ponderationCoefs[0];
183 float t = ((float) pathI*ponderationNbVertices)/pathNbVertices;
187 pathCoefs[pathI] = ponderationCoefs[i];
191 (t-i)*(ponderationCoefs[i+1]-ponderationCoefs[i]);
194 delete [] ponderationCoefs;
207 int pathIndex = pathInitialPos;
208 int pathDirection = +1;
226 vertex0 = vertex1 - (vertex2 - vertex1);
231 vertex3 = vertex2 + (vertex2 - vertex1);
235 CVertex vector0 = vertex1 - vertex0;
236 CVertex vector1 = vertex2 - vertex1;
237 CVertex vector2 = vertex3 - vertex2;
239 CVertex axis0 = vector0 * vector1;
240 CVertex axis1 = vector1 * vector2;
242 if (axis0.
isNull()) axis0 = OZ;
243 if (axis1.
isNull()) axis1 = OZ;
250 if (AScaleExtrudedCells)
260 if (ARotateExtrudedCells)
261 matrix.
rotate(vertex1, axis0, angle0/2);
265 if (ARotateExtrudedCells)
266 matrix.
rotate(vertex2, axis1, angle1/2);
268 if (AScaleExtrudedCells)
279 if (APonderationPath!=NULL)
283 if (!
isZero(pathCoefs[pathIndex]))
284 coef /= pathCoefs[pathIndex];
286 pathIndex += pathDirection;
287 coef *= pathCoefs[pathIndex];
288 matrix.
scale(vertex2, coef);
294 for (; cov->
cont(); ++(*cov))
318 ++path;
if (!path.
cont())
break;
321 { ++path;
if (!path.
cont())
break; }
325 current =
alpha(ADart, ADim+1);
327 pathIndex = pathInitialPos;
328 pathDirection = - pathDirection;
342 bool AExtrusionWithAdjacentSews,
343 int AInitialTranslateExtrudedCells,
344 int AInitialRotateExtrudedCells,
345 bool ARotateExtrudedCells,
346 bool AScaleExtrudedCells,
347 CDart* APonderationPath)
350 assert(1<=ADim && ADim<=2);
351 assert(0<=AInitialTranslateExtrudedCells
352 && AInitialTranslateExtrudedCells<=2);
353 assert(0<=AInitialRotateExtrudedCells
354 && AInitialRotateExtrudedCells<=2);
357 CVertex pathOrigin , pathDirection ;
358 CVertex cellsOrigin, cellsDirection;
375 if (AInitialRotateExtrudedCells==0)
414 if (AInitialTranslateExtrudedCells!=0 || AInitialRotateExtrudedCells!=0)
424 if (AInitialRotateExtrudedCells!=0)
432 vector1 /= vector1.
norm();
435 pathDirection = vector1;
443 vector0 /= vector0.
norm();
445 pathDirection = (vector0 + vector1) / 2;
448 if (pathDirection.
isNull())
470 cellsDirection /= nbCells;
472 if (cellsDirection.
isNull())
473 cellsDirection = ADim==0 ? OX : ADim==1 ? OY : OZ;
480 if (AInitialRotateExtrudedCells!=0)
482 if (AInitialRotateExtrudedCells==1)
486 matrix.
orientate(cellsOrigin, cellsDirection, pathDirection);
496 matrix.
orientate(pathOrigin, pathDirection, cellsDirection);
502 if (AInitialTranslateExtrudedCells!=0)
504 if (AInitialTranslateExtrudedCells==1)
508 translate(treated, pathOrigin - cellsOrigin);
515 translate(treated, cellsOrigin - pathOrigin);
533 ARotateExtrudedCells, AScaleExtrudedCells,
535 extruded, directInfoIndex);
550 if (AInitialTranslateExtrudedCells==2)
553 matrix.
translate(pathOrigin - cellsOrigin);
558 if (AInitialRotateExtrudedCells==2)
561 matrix.
orientate(pathOrigin, cellsDirection, pathDirection);
573 assert(!AAxeDirection.
isNull());
578 bool closed =
isZero(nbRounds - floor(nbRounds));
586 matrix.
rotate(AAxeVertex, AAxeDirection, AAngle/ANbEdges);
588 int nbVertices = closed ? ANbEdges : ANbEdges + 1;
590 CDart* current = extremity;
592 for (
int i=0; i<nbVertices; ++i)
607 bool AExtrusionWithAdjacentSews,
608 bool ARotateExtrudedCells,
609 bool AScaleExtrudedCells,
610 CDart* APonderationPath,
611 int AMarkExtruded,
int ADirectInfoIndex)
615 bool closed =
isZero(nbRounds - floor(nbRounds));
619 assert(!AAxeDirection.
isNull());
624 AFirstVertex, AAngle, ANbEdges);
628 AExtrusionWithAdjacentSews,
629 ARotateExtrudedCells, AScaleExtrudedCells,
631 AMarkExtruded, ADirectInfoIndex);
644 bool AExtrusionWithAdjacentSews,
645 int AInitialTranslateExtrudedCells,
646 int AInitialRotateExtrudedCells,
647 bool ARotateExtrudedCells,
648 bool AScaleExtrudedCells,
649 CDart* APonderationPath)
652 assert(!AAxeDirection.
isNull());
653 assert(0<=AInitialTranslateExtrudedCells
654 && AInitialTranslateExtrudedCells<=2);
655 assert(0<=AInitialRotateExtrudedCells
656 && AInitialRotateExtrudedCells<=2);
659 bool closed =
isZero(nbRounds - floor(nbRounds));
665 if (AInitialRotateExtrudedCells==0)
712 bary, AAngle, ANbEdges);
716 AExtrusionWithAdjacentSews,
717 0, AInitialRotateExtrudedCells,
718 ARotateExtrudedCells,