28 #include "dart-vertex.hh"
34 using namespace GMap3d;
39 FParameterGMapV(AParameterGMapV),
40 FParameterDart(AParameterDart),
41 FParameterSelection(AParameterSelection)
43 assert(FParameterGMapV != NULL && FParameterDart != NULL);
48 if (FParameterSelection != NULL)
54 FParameterGMapV(APrecompile.FParameterGMapV),
56 (APrecompile.FParameterDart->copy())),
57 FParameterSelection(APrecompile.FParameterSelection)
59 assert(FParameterGMapV != NULL && FParameterDart != NULL);
64 if (FParameterSelection != NULL)
73 if (FParameterSelection != NULL)
85 setGMapVertex(static_cast<CParameterGMapVertex *>(AParameter));
88 setDart(static_cast<CParameterDart *>(AParameter));
91 setSelection(static_cast<CParameterSelection *>(AParameter));
97 {
return FParameterDart; }
101 assert(AParameterGMapV != NULL);
104 FParameterGMapV = AParameterGMapV;
110 assert(ADart != NULL);
113 FParameterDart = ADart;
119 if (ASelection != NULL)
122 if (FParameterSelection != NULL)
125 FParameterSelection = ASelection;
137 return ADart->getAlpha(ADim);
141 CDart* res = ADart->getAlpha(ADim);
145 res = res->getAlpha(ADim+1)->getAlpha(ADim);
160 start = start->getAlpha(0);
172 CVertex * v1 = &FParameterGMapV->
getDrawingMap()->getBurstVertex(ADart);
185 computeBurstExtremity(ADart);
198 const GLfloat * clSel = NULL;
199 const GLfloat * clUnsel = NULL;
200 const GLfloat * clLast = NULL;
201 const GLfloat * cl0Remove= NULL;
202 const GLfloat * cl1Remove= NULL;
207 if (FParameterSelection != NULL)
212 clSel = FParameterDart->
214 clUnsel = FParameterDart->
216 clLast = FParameterDart->
218 cl0Remove= FParameterDart->
220 cl1Remove= FParameterDart->
229 glColor3fv(cl1Remove);
239 CDynamicCoverageAll it(FParameterGMapV->
getMap());
242 for (; it.cont(); ++it)
243 if (mark == -1 || !FParameterGMapV->
getMap()->isMarked(*it, mark))
249 glColor3fv(cl0Remove);
258 for (it.reinit(); it.cont(); ++it)
259 if (FParameterGMapV->
getMap()->isMarked(*it, mark) && *it != last)
275 #define DMAX (20) // Distance maximum pour la sélection d'un segment.
276 #define RFREE (6) // Distance maximum pour la sélection d'un point.
281 #define SQR(X) (sqr((double)(X)))
283 float xa = MIN(x1, x2) -
DMAX;
284 float xb = MAX(x1, x2) +
DMAX;
285 float ya = MIN(y1, y2) -
DMAX;
286 float yb = MAX(y1, y2) +
DMAX;
288 if (x < xa || x > xb || y < ya || y > yb)
292 if (x1 == x2 && y1 == y2)
295 double k = - double((x1 - x2) * (x - x1) + (y - y1) * (y1 - y2)) /
296 (
SQR(x1 - x2) +
SQR(y1 - y2));
299 if (k <= 0)
return sqr(x -x1) + sqr(y - y1);
302 if (k >= 1)
return sqr(x -x2) + sqr(y - y2);
305 return sqr(k*(x2 - x1) + x1 - x) + sqr(k*(y2 - y1) + y1 - y);
310 assert(AView != NULL);
312 CDart* nearest = NULL;
315 for (CDynamicCoverageAll it(FParameterGMapV->
getMap()); it.cont(); ++it)
317 CDart* current = *it;
322 float seg1[3], seg2[3];
324 AView->
project(v1.getX(), v1.getY(), v1.getZ(), seg1);
326 if (FParameterGMapV->
getMap()->isFree0(current))
335 AView->
project(e.getX(), e.getY(), e.getZ(), seg2);
342 if (currentDist < bestDist)
345 bestDist = currentDist;