38 #include <GLUT/glut.h>
47 #include "attribute-vertex.hh"
49 using namespace GMap3d;
76 CVertex * p1, * p2, p3, p4;
79 CVertex center(0.0,0.0,0.0);
82 int markCenter = G->getNewMark();
86 CCoverage* DCe = G->getDynamicCoverage(dgm, ORBIT_01);
87 for (DCe->reinit(); DCe->cont(); (*DCe)++)
91 if (!G->isMarked(de, markCenter))
95 p2 = (CAttributeVertex*)alpha;
98 center.setX(center.getX() + p2->getX());
99 center.setY(center.getY() + p2->getY());
100 center.setZ(center.getZ() + p2->getZ());
106 G->setMark(de, markCenter);
108 G->setMark(G->alpha1(de), markCenter);
113 center.setX(center.getX()/(float)nbPoints);
114 center.setY(center.getY()/(float)nbPoints);
115 center.setZ(center.getZ()/(float)nbPoints);
126 G->unsetMark(de, markCenter);
128 if (!G->isMarked(de, markDart))
132 p1 = (CAttributeVertex*)alpha;
137 p2 = (CAttributeVertex*)alpha;
141 v.setXYZ(p2->getX()-p1->getX(),
142 p2->getY()-p1->getY(),
143 p2->getZ()-p1->getZ());
153 p3.setXYZ(p1->getX() + v.getX()/10.0,
154 p1->getY() + v.getY()/10.0,
155 p1->getZ() + v.getZ()/10.0);
160 if (G->isFree1(G->alpha0(de)))
167 p4.setXYZ(p2->getX() - v.getX()/10.0,
168 p2->getY() - v.getY()/10.0,
169 p2->getZ() - v.getZ()/10.0);
178 v.setXYZ(center.getX()-p3.getX(),
179 center.getY()-p3.getY(),
180 center.getZ()-p3.getZ());
181 p3.setXYZ(p3.getX() + v.getX()/5.0,
182 p3.getY() + v.getY()/5.0,
183 p3.getZ() + v.getZ()/5.0);
185 v.setXYZ(center.getX()-p4.getX(),
186 center.getY()-p4.getY(),
187 center.getZ()-p4.getZ());
188 p4.setXYZ(p4.getX() + v.getX()/5.0,
189 p4.getY() + v.getY()/5.0,
190 p4.getZ() + v.getZ()/5.0);
194 G->addAttribute(de,ORBIT_SELF,
new CAttributeVertex(p3));
197 G->setMark(de, markDart);
201 G->addAttribute(G->alpha0(de),ORBIT_SELF,
202 new CAttributeVertex(p4));
206 G->setMark(G->alpha0(de), markDart);
212 G->freeMark(markCenter);
233 CVertex center(0.0,0.0,0.0);
236 int markCenter = G->getNewMark();
240 CDynamicCoverageAll Cgm(G);
241 for (Cgm.reinit(); Cgm.cont(); Cgm++)
245 if (!G->isMarked(dgm, markVolume))
248 if (!G->isFree3(dgm))
251 CCoverage* DCe = G->getDynamicCoverage(dgm, ORBIT_012);
258 if (!G->isMarked(de, markCenter))
262 p1 = (CAttributeVertex*)alpha;
265 center.setX(center.getX() + p1->getX());
266 center.setY(center.getY() + p1->getY());
267 center.setZ(center.getZ() + p1->getZ());
273 G->setMark(de, markCenter);
275 G->setMark(G->alpha1(de), markCenter);
280 center.setX(center.getX()/(float)nbPoints);
281 center.setY(center.getY()/(float)nbPoints);
282 center.setZ(center.getZ()/(float)nbPoints);
293 G->unsetMark(G->alpha0(de), markCenter);
295 if (!G->isMarked(de, markVolume))
302 alpha = G->getAttribute(de, ORBIT_SELF,
304 p1 = (CAttributeVertex*)alpha;
308 v.setXYZ(center.getX()-p1->getX(),
309 center.getY()-p1->getY(),
310 center.getZ()-p1->getZ());
312 p1->setXYZ(p1->getX() + v.getX()/5.0,
313 p1->getY() + v.getY()/5.0,
314 p1->getZ() + v.getZ()/5.0);
318 G->setMark(de, markVolume);
326 G->setMark(dgm, markVolume);
331 G->freeMark(markCenter);
352 int markDart = G->getNewMark();
353 int markVolume = G->getNewMark();
357 CDynamicCoverageAll Cgm(G);
358 for (Cgm.reinit(); Cgm.cont(); Cgm++)
362 if (!G->isMarked(dgm, markDart))
369 p1 = (CAttributeVertex*)alpha;
372 G->addAttribute(dgm, ORBIT_SELF,
new CAttributeVertex(*p1));
376 G->setMark(dgm, markDart);
393 for (Cgm.reinit(); Cgm.cont(); Cgm++)
395 G->unsetMark(*Cgm, markDart);
396 G->unsetMark(*Cgm, markVolume);
398 G->freeMark(markDart);
399 G->freeMark(markVolume);
421 CDynamicCoverageAll Cgm(G);
422 for (Cgm.reinit(); Cgm.cont(); Cgm++)
428 p =(CAttributeVertex*)alpha;
433 glVertex3f(p->getX(), p->getY(), p->getZ());
456 int markDart = G->getNewMark();
459 CDynamicCoverageAll Cgm(G);
460 for (Cgm.reinit(); Cgm.cont(); Cgm++)
464 if (!G->isMarked(dgm, markDart))
468 if (!G->isFree(dgm,i) &&
469 !G->isMarked(G->alpha(dgm,i), markDart))
473 p =(CAttributeVertex*)alpha;
476 alpha = G->getAttribute(G->alpha(dgm,i), ORBIT_SELF,
478 p1 = (CAttributeVertex*)alpha;
483 glVertex3f(p->getX(), p->getY(), p->getZ());
484 glVertex3f(p1->getX(), p1->getY(), p1->getZ());
488 G->setMark(G->alpha(dgm,i), markDart);
492 G->setMark(dgm, markDart);
497 for (Cgm.reinit(); Cgm.cont(); Cgm++)
498 G->unsetMark(*Cgm, markDart);
499 G->freeMark(markDart);