34 #include "g-map-vertex.hh"
35 #include "geometry.hh"
36 using namespace GMap3d;
40 if ( AVector!= FParameterTranslation->
getVector() )
42 FParameterTranslation->
setVector(AVector);
45 FMap->translate(FDeformationMark, AVector,
46 FDirectInfoVertex, FDirectInfoPonderation);
53 {
return FParameterTranslation->
getVector(); }
64 addPonderationCoefs();
65 updatePonderationCoefs();
68 delPonderationCoefs();
70 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
107 if (AAngle!=FParameterRotation->
getAngle())
109 FParameterRotation->
setAngle(AAngle);
114 AAngle, FDirectInfoVertex, FDirectInfoPonderation);
121 {
return FParameterRotation->
getAngle(); }
132 addPonderationCoefs();
133 updatePonderationCoefs();
136 delPonderationCoefs();
138 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
167 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
207 CVertex(AValue,AValue,AValue),
208 FDirectInfoVertex, FDirectInfoPonderation);
219 if ( AValue!=FParameterScale->
getCoef() )
221 FParameterScale->
setCoef(AValue);
225 AValue, FDirectInfoVertex, FDirectInfoPonderation);
232 {
return FParameterScale->
getCoef(); }
236 if ( AValue!=FParameterScale->
getCoef(ADim) )
238 FParameterScale->
setCoef(ADim,AValue);
243 FDirectInfoPonderation);
250 {
return FParameterScale->
getCoef(ADim); }
261 addPonderationCoefs();
262 updatePonderationCoefs();
265 delPonderationCoefs();
268 FParameterScale->
getCoef(), FDirectInfoVertex,
269 FDirectInfoPonderation);
281 void CControlerGMap::modeObjectTransformationBegin(
bool APonderation)
283 FDeformationDone =
false;
287 FDirectInfoVertex =
FMap->getNewDirectInfo();
288 FMap->duplicateVertexToDirectInfo(FDeformationMark, FDirectInfoVertex);
293 FMap->markIncidentCells(ORBIT_VOLUME, FDeformationMark,
295 FMap->markIncidentCells(ORBIT_VERTEX,
297 FMap->markIncidentCells(ORBIT_VOLUME,
302 addPonderationCoefs();
303 updatePonderationCoefs();
306 for (
unsigned int i=0; i<
FViews.size(); ++i)
310 void CControlerGMap::modeTranslationBegin()
312 modeObjectTransformationBegin(FParameterTranslation->
getPonderation());
314 FParameterTranslation->
setVector(ORIGIN);
317 void CControlerGMap::modeRotationBegin()
319 modeObjectTransformationBegin(FParameterRotation->
getPonderation());
321 CVertex bary =
FMap->directInfoBarycenter(FDirectInfoVertex);
325 void CControlerGMap::modeScaleBegin()
330 FParameterScale->
setCenter(
FMap->directInfoBarycenter(FDirectInfoVertex));
333 void CControlerGMap::modeObjectTransformationEnd(
bool APonderation)
335 FMap->deleteDuplicatedVertex(FDirectInfoVertex);
336 FMap->freeDirectInfo(FDirectInfoVertex);
343 delPonderationCoefs();
345 for (
unsigned int i=0; i<
FViews.size(); ++i)
348 if (FDeformationDone)
354 void CControlerGMap::modeTranslationEnd()
356 modeObjectTransformationEnd(FParameterTranslation->
getPonderation());
359 void CControlerGMap::modeRotationEnd()
361 modeObjectTransformationEnd(FParameterRotation->
getPonderation());
364 void CControlerGMap::modeScaleEnd()
369 void CControlerGMap::modeTranslationOperationStart()
372 assert(view != NULL);
376 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
379 void CControlerGMap::modeRotationOperationStart()
382 assert(view != NULL);
388 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
391 void CControlerGMap::modeScaleOperationStart()
394 assert(view != NULL);
398 FMap->updateDirectInfoWithVertex(FDirectInfoVertex);
401 void CControlerGMap::modeTranslationOperationMove()
406 CVertex vect= CVertex(last3D[0], last3D[1], last3D[2]) -
409 FDeformationDone |= !vect.isNull();
413 void CControlerGMap::modeRotationOperationMove()
419 CGeometry::orthoProjectVertexOnPlane(FParameterRotation->
getAxeVertex(),
424 CVertex(last3D[0], last3D[1], last3D[2])-R,
427 FDeformationDone |= !isZero(newAngle);
431 void CControlerGMap::modeScaleOperationMove()
439 FDeformationDone |= !areEqual(coef, 1.0);
449 CGeometry::orthoProjectVertexOnPlane(FParameterScale->
getCenter(),
456 for (
int i=0;i<3;++i)
457 if (!isZero(vect.getCoord(i)))
458 vect.setCoord(i,1/vect.getCoord(i));
460 vect = (CVertex(last3D[0], last3D[1], last3D[2])-R).multiply(vect);
462 FDeformationDone |= ( vect != CVertex(1,1,1) );
468 void CControlerGMap::modeTransformationOperationStop()
471 void CControlerGMap::addPonderationCoefs()
473 FDirectInfoPonderation =
FMap->getNewDirectInfo();
475 FDirectInfoPonderation,
479 void CControlerGMap::delPonderationCoefs()
482 FDirectInfoPonderation,
484 FMap->freeDirectInfo(FDirectInfoPonderation);
485 FDirectInfoPonderation = -1;
488 void CControlerGMap::updatePonderationCoefs()
500 FDirectInfoPonderation, center);
505 FDirectInfoPonderation, center, vect);
510 FDirectInfoPonderation, center, vect);
519 FDirectInfoPonderation,
520 FParameterPonderation->
521 getPonderationStretchInMin(),
522 FParameterPonderation->
523 getPonderationStretchInMax());
526 FDirectInfoPonderation,
527 FParameterPonderation->
528 getPonderationFunctionType());
532 FDirectInfoPonderation,
533 FParameterPonderation->
534 getPonderationStretchOutMin(),
535 FParameterPonderation->
536 getPonderationStretchOutMax());