27 #include "transformation-matrix.hh"
28 #include "geometry.hh"
30 using namespace GMap3d;
53 CParameterObjectPosition::CParameterObjectPosition(
bool ANeedRotation,
56 FNeedRotation(ANeedRotation)
64 FNeedRotation(AParam.FNeedRotation)
104 FDimensions = 2 * FScale * FProportions;
107 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
108 matrix.rotate(FRotations);
117 {
return FProportions.getX(); }
119 {
return FProportions.getY(); }
121 {
return FProportions.getZ(); }
124 {
return FProportions; }
138 if (FProportions != AValues)
142 FProportions = AValues;
148 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
149 matrix.rotate(FRotations);
157 {
return FDimensions.getX(); }
159 {
return FDimensions.getY(); }
161 {
return FDimensions.getZ(); }
164 {
return FDimensions; }
167 {
setDimensions(AX, FDimensions.getY(), FDimensions.getZ()); }
169 {
setDimensions(FDimensions.getX(), AY, FDimensions.getZ()); }
171 {
setDimensions(FDimensions.getX(), FDimensions.getY(), AZ); }
178 if (FDimensions != AValues)
182 FDimensions = AValues;
185 if (! FDimensions.isNull())
186 FProportions = isZero(FScale) ? ORIGIN : FDimensions / 2 /
getScale();
189 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
198 {
return FCenter.getX(); }
200 {
return FCenter.getY(); }
202 {
return FCenter.getZ(); }
208 {
setCenter(AX, FCenter.getY(), FCenter.getZ()); }
210 {
setCenter(FCenter.getX(), AY, FCenter.getZ()); }
212 {
setCenter(FCenter.getX(), FCenter.getY(), AZ); }
219 if (FCenter != AVertex)
226 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
235 {
return FRotations.getX(); }
237 {
return FRotations.getY(); }
239 {
return FRotations.getZ(); }
247 {
setRotations(AAlpha, FRotations.getY(), FRotations.getZ()); }
249 {
setRotations(FRotations.getX(), ABeta, FRotations.getZ()); }
251 {
setRotations(FRotations.getX(), FRotations.getY(), AGamma); }
260 if (FRotations != AAngles)
264 FRotations = AAngles;
266 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
267 matrix.rotate(AAngles);
282 {
return FFirstVertex.getX(); }
284 {
return FFirstVertex.getY(); }
286 {
return FFirstVertex.getZ(); }
289 {
return FFirstVertex; }
308 bool AKeepNormalVector)
312 bool AKeepNormalVector)
314 if (FFirstVertex != AVertex)
318 FFirstVertex = AVertex;
320 CVertex V(FFirstVertex - FCenter);
323 if (isZero(FProportions.getX()))
324 FProportions.setX(1);
327 FScale = V.norm() / FProportions.getX();
330 FDimensions = 2 * FScale * FProportions;
333 if (! V.isNull() && ! AKeepNormalVector)
334 FNormalVector = V * (isZero(V.getY()) ? OY : OX);
337 FRotations = CGeometry::getAngles(V, FNormalVector);
342 {
return FNormalVector.getX(); }
344 {
return FNormalVector.getY(); }
346 {
return FNormalVector.getZ(); }
349 {
return FNormalVector; }
363 if (FNormalVector != AVector)
367 FNormalVector = AVector;
370 FRotations = CGeometry::getAngles(FFirstVertex - FCenter, FNormalVector);
373 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
374 matrix.rotate(FRotations);
383 CTransformationMatrix matrix(CTransformationMatrix::IdentityMatrix);
386 matrix.rotate(OY, 90);
388 matrix.scale(FDimensions);
389 matrix.rotate(FRotations);
390 matrix.translate(FCenter);