27 using namespace GMap3d;
59 matrix.
rotate(OZ, 360.0/An);
63 for (
int i=0; i<An; ++i)
76 assert(AMeridians>=3);
77 assert(AParallels>=1);
87 rotationMatrix.
rotate(OZ, 360.0/AMeridians);
94 for (
int j=0; j<AParallels; ++j, currentY =
alpha0121(currentY))
98 TCoordinate alpha = 180.0*(j+1)/(AParallels+1) - 90.0;
103 CDart * currentX = alpha1(currentY);
105 for (
int i=0; i<AMeridians; ++i, currentX =
alpha0121(currentX))
108 rotationMatrix.
applyOn(vertex);
113 if (ASouthPole!=NULL) * ASouthPole = southPole;
114 if (ANorthPole!=NULL) * ANorthPole = northPole;
119 assert(AMeridians>=3);
120 assert(AParallels>=1);
131 bool AClose1,
bool AClose2)
133 assert(AMeridians>=3);
134 assert(AParallels>=1);
136 CDart * border1, * border2;
143 rotationMatrix.
rotate(OZ, 360.0/AMeridians);
146 CDart * currentY = border1;
148 for (
int i=0; i<AMeridians; ++i, currentY =
alpha0121(currentY))
150 CDart * currentX = alpha1(currentY);
152 for (
int j=0; j<=AParallels; ++j, currentX =
alpha0121(currentX))
157 vertex += OZ/AParallels;
162 rotationMatrix.
applyOn(vertex);
166 if (ABorder1!=NULL) * ABorder1 = border1;
167 if (ABorder2!=NULL) * ABorder2 = border2;
171 bool AClose1,
bool AClose2)
173 assert(AMeridians>=3);
174 assert(AParallels>=1);
178 createCylinder(AMeridians,AParallels, &border1,NULL, AClose1,AClose2);
187 assert(AMeridians>=3);
188 assert(AParallels>=1);
190 CDart * baseDart, * poleDart;
199 rotationMatrix.
rotate(OZ, 360.0/AMeridians);
201 CDart * currentX = alpha1(baseDart);
203 for (
int i=0; i<AParallels; ++i, currentX =
alpha0121(currentX))
207 vertex.
setX(0.5*(AParallels-i)/AParallels);
208 vertex.
setZ(((
float) i)/AParallels-0.5);
210 CDart * currentY = alpha1(currentX);
212 for (
int j=0; j<AMeridians; ++j, currentY =
alpha0121(currentY))
215 rotationMatrix.
applyOn(vertex);
220 if (ABaseDart!=NULL) * ABaseDart = baseDart;
221 if (APoleDart!=NULL) * APoleDart = poleDart;
227 assert(AMeridians>=3);
228 assert(AParallels>=1);
232 createPyramid(AMeridians,AParallels, &baseDart,NULL, ACloseBase);
241 assert(AMeridians>=3);
242 assert(AParallels>=3);
259 CDart * currentY = alpha1(equator);
261 for (
int j=0; j<AParallels; ++j, currentY =
alpha0121(currentY))
266 CDart * currentX = alpha1(currentY);
268 for (
int i=0; i<AMeridians; ++i, currentX =
alpha0121(currentX))
278 if (AEquator!=NULL) * AEquator = equator;
284 assert(AMeridians>=3);
285 assert(AParallels>=3);
289 createTorus(AMeridians,AParallels, ARadiusProportion, &equator);
295 CDart * ASquareCorners[2][2])
299 assert(AMeshDimension>=0 && AMeshDimension<=2);
300 assert(ASquareCorners!=NULL);
302 if (AMeshDimension==0)
307 if (AMeshDimension==2)
329 CDart * squareCorners[2][2];
333 return squareCorners[0][0];
338 bool ACreatedFaces[3][2],
339 CDart * AFacesCorners[3][2][2][2])
344 assert(AMeshDimension>=0 && AMeshDimension<=2);
345 assert(AFacesCorners!=NULL);
349 ACreatedFaces, AFacesCorners);
352 if (AMeshDimension==0)
355 int s[3] = { ASx, ASy, ASz};
358 for (
int i=0; i<2; ++i)
359 for (
int j=0; j<2; ++j)
360 for (
int k=0; k<2; ++k)
364 if (ACreatedFaces[0][i]) corner = AFacesCorners[0][i][j][k];
365 else if (ACreatedFaces[1][j]) corner = AFacesCorners[1][j][k][i];
366 else if (ACreatedFaces[2][k]) corner = AFacesCorners[2][k][i][j];
374 if (AMeshDimension>=1)
375 for (
int dim=0; dim<3; ++dim)
377 int dim1 = (dim+1) % 3;
378 int dim2 = (dim+2) % 3;
380 for (
int side1=0; side1<2; ++side1)
381 for (
int side2=0; side2<2; ++side2)
382 if (ACreatedFaces[dim1][side1] || ACreatedFaces[dim2][side2])
385 (side1-0.5)*BASE[dim1] + (side2-0.5)*BASE[dim2] - BASE[dim]/2;
390 ACreatedFaces[dim2][side2]
391 ? AFacesCorners[dim2][side2][ 0][side1]
392 : alpha1(AFacesCorners[dim1][side1][side2][ 0]);
399 if (AMeshDimension==2)
400 for (
int dim=0; dim<3; ++dim)
402 int dim1 = (dim+1) % 3;
403 int dim2 = (dim+2) % 3;
405 for (
int side=0; side<2; ++side)
406 if (ACreatedFaces[dim][side])
408 CVertex origin = (side-0.5)*BASE[dim] - (BASE[dim1]+BASE[dim2])/2;
411 origin, BASE[dim1], BASE[dim2]);
413 CDart * first = AFacesCorners[dim][side][0][0];
422 bool ACreatedFaces[3][2],
425 CDart * facesCorners[3][2][2][2];
431 for (dim=0; dim<3; ++dim)
432 if (ACreatedFaces[dim][0] && ACreatedFaces[dim][1] &&
433 !ACreatedFaces[(dim+1)%3][0] && !ACreatedFaces[(dim+1)%3][1] &&
434 !ACreatedFaces[(dim+2)%3][0] && !ACreatedFaces[(dim+2)%3][1])
436 * ADart1 = facesCorners[dim][0][0][0];
437 * ADart2 = facesCorners[dim][1][0][0];
443 for (dim=0; dim<3; ++dim)
444 for (
int side=0; side<2; ++side)
445 if (ACreatedFaces[dim][side])
447 * ADart1 = facesCorners[dim][side][0][0];