libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
altransformhelpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 
8 #pragma once
9 #ifndef _LIBALMATH_ALMATH_TOOLS_ALTRANSFORMHELPERS_H_
10 #define _LIBALMATH_ALMATH_TOOLS_ALTRANSFORMHELPERS_H_
11 
20 #include <almath/types/alpose2d.h>
23 
24 namespace AL {
25  namespace Math {
26 
27 
31 
40  ALMATH_API void transformLogarithmInPlace(
48  const Transform& pT,
49  Velocity6D& pVel);
50 
51 
55 
64  ALMATH_API Velocity6D transformLogarithm(const Transform& pT);
71 
72 
74 
78  ALMATH_API Transform velocityExponential(const Velocity6D& pVel);
85 
86  // TODO: Add to doc or set private.
87  ALMATH_API void velocityExponentialInPlace(
88  const Velocity6D& pVel,
89  Transform& pT);
90 
92 
120  ALMATH_API void changeReferenceVelocity6D(
129  const Transform& pT,
130  const Velocity6D& pVelIn,
131  Velocity6D& pVelOut);
132 
134 
162  ALMATH_API void changeReferencePosition6D(
171  const Transform& pT,
172  const Position6D& pPosIn,
173  Position6D& pPosOut);
174 
175  // TODO: rename argument.
176  ALMATH_API void changeReferencePosition3DInPlace(
177  const Transform& pT,
178  Position3D& pPosOut);
179 
180  // TODO: rename argument.
182  const Transform& pT,
183  Position3D& pPosOut);
184 
186 
205  ALMATH_API void changeReferencePosition3D(
214  const Transform& pT,
215  const Position3D& pPosIn,
216  Position3D& pPosOut);
217 
219 
231  ALMATH_API void changeReferenceTransposePosition3D(
239  const Transform& pT,
240  const Position3D& pPosIn,
241  Position3D& pPosOut);
242 
244 
256  ALMATH_API void changeReferenceTransform(
264  const Transform& pT,
265  const Transform& pTIn,
266  Transform& pTOut);
267 
269 
281  ALMATH_API void changeReferenceTransposeTransform(
289  const Transform& pT,
290  const Transform& pTIn,
291  Transform& pTOut);
292 
293 
295 
323  ALMATH_API void changeReferenceTransposeVelocity6D(
332  const Transform& pT,
333  const Velocity6D& pVelIn,
334  Velocity6D& pVelOut);
335 
337 
365  ALMATH_API void changeReferenceTransposePosition6D(
374  const Transform& pT,
375  const Position6D& pPosIn,
376  Position6D& pPosOut);
377 
388  ALMATH_API void transformMeanInPlace(
389  const Transform& pTIn1,
390  const Transform& pTIn2,
391  const float& pVal,
392  Transform& pTOut);
393 
405  ALMATH_API Transform transformMean(
406  const Transform& pTIn1,
407  const Transform& pTIn2,
408  const float& pVal = 0.5f);
409 
412 
419  ALMATH_API Transform transformFromRotationPosition3D(
429  const Rotation& pRot,
430  const float& pX,
431  const float& pY,
432  const float& pZ);
433 
436 
442  ALMATH_API Transform transformFromRotationPosition3D(
450  const Rotation& pRot,
451  const Position3D& pPos);
452 
455 
466  ALMATH_API void transformFromPosition3DInPlace(
471  const Position3D& pPosition,
472  Transform& pTransform);
473 
477 
488  ALMATH_API Transform transformFromPosition3D(const Position3D& pPosition);
496 
500 
511  ALMATH_API void transformFromRotationInPlace(
516  const Rotation& pRotation,
517  Transform& pTransform);
518 
520 
531  ALMATH_API Transform transformFromRotation(const Rotation& pRotation);
538 
545  ALMATH_API void rotationFromTransformInPlace(
546  const Transform& pTransform,
547  Rotation& pRotation);
548 
557  ALMATH_API Rotation rotationFromTransform(const Transform& pTransform);
558 
568  ALMATH_API Rotation3D rotation3DFromRotation(const Rotation& pRotation);
569 
583  ALMATH_API Rotation rotationFromAxesXY(const Position3D& pX, const Position3D& pY);
584 
598  ALMATH_API Rotation rotationFromAxesXZ(const Position3D& pX, const Position3D& pZ);
599 
613  ALMATH_API Rotation rotationFromAxesYZ(const Position3D& pY, const Position3D& pZ);
614 
628  ALMATH_API Rotation rotationFromAxesXYZ(const Position3D& pX, const Position3D& pY, const Position3D& pZ);
629 
630 
637  ALMATH_API void position6DFromTransformInPlace(
638  const Transform& pT,
639  Position6D& pPos);
640 
647  ALMATH_API Position6D position6DFromTransform(const Transform& pT);
648 
655  ALMATH_API void transformFromPose2DInPlace(
656  const Pose2D& pPose,
657  Transform& pT);
658 
665  ALMATH_API Transform transformFromPose2D(const Pose2D& pPose);
666 
673  ALMATH_API void pose2DFromTransformInPlace(
674  const Transform& pT,
675  Pose2D& pPos);
676 
683  ALMATH_API Pose2D pose2DFromTransform(const Transform& pT);
684 
691  ALMATH_API void position2DFromTransformInPlace(
692  const Transform& pT,
693  Position2D& pPos);
694 
701  ALMATH_API Position2D position2DFromTransform(const Transform& pT);
702 
711  ALMATH_API Transform transformFromRotation3D(const Rotation3D& pRotation);
712 
719  ALMATH_API Transform transformFromPosition6D(const Position6D& pPosition6D);
720 
739  ALMATH_API void position6DFromTransformDiffInPlace(
740  const Transform& pCurrent,
741  const Transform& pTarget,
742  Position6D& result);
743 
753  ALMATH_API Position6D position6DFromTransformDiff(
754  const Transform& pCurrent,
755  const Transform& pTarget);
756 
760 
774  ALMATH_API void position3DFromTransformInPlace(
779  const Transform& pT,
780  Position3D& pPos);
781 
785 
799  ALMATH_API Position3D position3DFromTransform(const Transform& pT);
804 
805 
814  ALMATH_API Rotation3D rotation3DFromTransform(const Transform& pT);
815 
824  ALMATH_API void transformFromRotVecInPlace(
825  const int pAxis,
826  const float pTheta,
827  const Position3D& pPos,
828  Transform& pT);
829 
837  ALMATH_API Transform transformFromRotVec(
838  const int pAxis,
839  const float pTheta,
840  const Position3D& pPos);
841 
842 
848  ALMATH_API void transformFromRotVecInPlace(
849  const Position3D& pPos,
850  Transform& pT);
851 
857  ALMATH_API Transform transformFromRotVec(const Position3D& pPos);
858 
863 
866  ALMATH_API Transform transformFromRotVec(
867  const int& pAxis,
868  const float& pTheta);
869 
870  ALMATH_API Position3D operator*(
871  const Transform& pT,
872  const Position2D& pPos);
873 
874  ALMATH_API Position3D operator*(
875  const Transform& pT,
876  const Position3D& pPos);
877 
885  ALMATH_API Transform axisRotationProjection(
886  const Position3D& pAxis,
887  const Transform& pT);
888 
896  ALMATH_API Rotation axisRotationProjection(
897  const Position3D& pAxis,
898  const Rotation& pRot);
899 
900 
907  ALMATH_API void axisRotationProjectionInPlace(
908  const Position3D& pAxis,
909  Transform& pT);
910 
917  ALMATH_API void axisRotationProjectionInPlace(
918  const Position3D& pAxis,
919  Rotation& pRot);
920 
927  ALMATH_API void orthogonalSpace(
928  const Position3D& pPos,
929  Transform& pTf);
930 
931  ALMATH_API Transform orthogonalSpace(const Position3D& pPos);
932 
933  ALMATH_API Transform transformFromQuaternion(
934  const Quaternion& pQua);
935 
936  ALMATH_API Quaternion quaternionFromTransform(
937  const Transform& pT);
938 
945  ALMATH_API Transform transformFromDisplacement(const Displacement& pDisp);
946 
953  ALMATH_API Displacement displacementFromTransform(const Transform& pTrans);
954 
955  } // namespace Math
956 } // namespace AL
957 #endif // _LIBALMATH_ALMATH_TOOLS_ALTRANSFORMHELPERS_H_
ALMATH_API void changeReferenceTransposeTransform(const Transform &pT, const Transform &pTIn, Transform &pTOut)
ALMATH_API void changeReferenceTransposePosition3D(const Transform &pT, const Position3D &pPosIn, Position3D &pPosOut)
ALMATH_API Transform velocityExponential(const Velocity6D &pVel)
ALMATH_API void changeReferencePosition3DInPlace(const Transform &pT, Position3D &pPosOut)
ALMATH_API void pose2DFromTransformInPlace(const Transform &pT, Pose2D &pPos)
Compute a Pose2D from a Transform.
ALMATH_API void orthogonalSpace(const Position3D &pPos, Transform &pTf)
ALMATH_API Rotation rotationFromAxesXY(const Position3D &pX, const Position3D &pY)
return a Rotation Matrix initialized with its direction vectors X and Y in world coordinates. These vectors represent, respectively, the first and second columns of the Rotation matrix. The vectors must be unitary and orthogonal.
ALMATH_API void position2DFromTransformInPlace(const Transform &pT, Position2D &pPos)
Compute a Position2D from a Transform.
ALMATH_API Rotation3D rotation3DFromTransform(const Transform &pT)
Create a Rotation3D (Roll, Pitch, Yaw) corresponding to the rotational part of the Transform...
ALMATH_API Position6D position6DFromTransformDiff(const Transform &pCurrent, const Transform &pTarget)
Computes a 6 differential motion require to move from a 4*4 Homogenous transform matrix Current to a ...
ALMATH_API Transform transformFromPose2D(const Pose2D &pPose)
Create a Transform from a Pose2D.
ALMATH_API Position2D position2DFromTransform(const Transform &pT)
Create a Position2D from a Transform.
ALMATH_API Position3D position3DFromTransform(const Transform &pT)
Create a Position3D from a Transform.
ALMATH_API Transform transformMean(const Transform &pTIn1, const Transform &pTIn2, const float &pVal=0.5f)
Preform a logarithmic mean of pTIn1 and pTIn2.
ALMATH_API Rotation rotationFromTransform(const Transform &pTransform)
ALMATH_API Transform transformFromDisplacement(const Displacement &pDisp)
ALMATH_API Transform transformFromRotation3D(const Rotation3D &pRotation)
Create a Transform from the 3 angles stored in a Rotation3D. The angles are composed in the following...
ALMATH_API void transformFromRotVecInPlace(const int pAxis, const float pTheta, const Position3D &pPos, Transform &pT)
Compute a Transform from
ALMATH_API void position6DFromTransformInPlace(const Transform &pT, Position6D &pPos)
Compute Position6D corresponding to the Transform.
ALMATH_API Displacement displacementFromTransform(const Transform &pTrans)
ALMATH_API Pose2D pose2DFromTransform(const Transform &pT)
Create a Pose2D from a Transform.
ALMATH_API void position6DFromTransformDiffInPlace(const Transform &pCurrent, const Transform &pTarget, Position6D &result)
Computes a 6 differential motion required to move from a 4*4 Homogenous transform matrix Current to a...
ALMATH_API Transform transformFromPosition3D(const Position3D &pPosition)
Create a 4*4 transform matrix from cartesian coordinates given in pPosition.
ALMATH_API void position3DFromTransformInPlace(const Transform &pT, Position3D &pPos)
Compute a Position3D from a Transform.
ALMATH_API Rotation rotationFromAxesXZ(const Position3D &pX, const Position3D &pZ)
return a Rotation Matrix initialized with its direction vectors X and Z in world coordinates. These vectors represent, respectively, the first and third columns of the Rotation matrix. The vectors must be unitary and orthogonal.
ALMATH_API void changeReferenceTransposePosition6D(const Transform &pT, const Position6D &pPosIn, Position6D &pPosOut)
ALMATH_API Transform transformFromRotationPosition3D(const Rotation &pRot, const float &pX, const float &pY, const float &pZ)
Create a Transform from 3D cartesian coordiantes and a Rotation.
ALMATH_API void transformFromPose2DInPlace(const Pose2D &pPose, Transform &pT)
Compute a Transform from a Pose2D.
ALMATH_API Rotation3D rotation3DFromRotation(const Rotation &pRotation)
return 3 angles which result in the equivalent rotation when composed in the following order: Rz(wz) ...
ALMATH_API void axisRotationProjectionInPlace(const Position3D &pAxis, Transform &pT)
ALMATH_API Transform transformFromQuaternion(const Quaternion &pQua)
ALMATH_API Transform transformFromRotVec(const int pAxis, const float pTheta, const Position3D &pPos)
ALMATH_API Transform transformFromPosition6D(const Position6D &pPosition6D)
Create a Transform from a Position6D.
ALMATH_API Transform transformFromRotation(const Rotation &pRotation)
ALMATH_API Quaternion quaternionFromTransform(const Transform &pT)
ALMATH_API void changeReferencePosition3D(const Transform &pT, const Position3D &pPosIn, Position3D &pPosOut)
ALMATH_API void changeReferenceTransform(const Transform &pT, const Transform &pTIn, Transform &pTOut)
ALMATH_API void rotationFromTransformInPlace(const Transform &pTransform, Rotation &pRotation)
Extract the position coordinates from a Transform.
ALMATH_API Velocity6D transformLogarithm(const Transform &pT)
Compute the logarithme of a transform. Angle must be between
ALMATH_API void changeReferencePosition6D(const Transform &pT, const Position6D &pPosIn, Position6D &pPosOut)
ALMATH_API void transformMeanInPlace(const Transform &pTIn1, const Transform &pTIn2, const float &pVal, Transform &pTOut)
Preform a logarithmic mean of pTIn1 and pTIn2 and put it in pTout.
ALMATH_API Rotation rotationFromAxesYZ(const Position3D &pY, const Position3D &pZ)
return a Rotation Matrix initialized with its direction vectors X and Y in world coordinates. These vectors represent, respectively, the second and third columns of the Rotation matrix. The vectors must be unitary and orthogonal.
ALMATH_API void transformLogarithmInPlace(const Transform &pT, Velocity6D &pVel)
Compute the logarithme of a transform. Angle must be between
ALMATH_API Rotation rotationFromAxesXYZ(const Position3D &pX, const Position3D &pY, const Position3D &pZ)
return a Rotation Matrix initialized with its direction vectors in world coordinates. The vectors represent the columns of the Rotation matrix. The vectors must be unitary and orthogonal.
ALMATH_API void changeReferenceTransposeVelocity6D(const Transform &pT, const Velocity6D &pVelIn, Velocity6D &pVelOut)
ALMATH_API void changeReferenceVelocity6D(const Transform &pT, const Velocity6D &pVelIn, Velocity6D &pVelOut)
ALMATH_API Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D:
ALMATH_API Transform axisRotationProjection(const Position3D &pAxis, const Transform &pT)
ALMATH_API void transformFromPosition3DInPlace(const Position3D &pPosition, Transform &pTransform)
Modify pTransform to set the translation part to pPosition.
ALMATH_API void velocityExponentialInPlace(const Velocity6D &pVel, Transform &pT)
ALMATH_API Position6D position6DFromTransform(const Transform &pT)
Compute Position6D corresponding to 4*4 Homogenous Transform.
ALMATH_API void transformFromRotationInPlace(const Rotation &pRotation, Transform &pTransform)
Modify the rotation part of the transform. The translation part of the transform is not modified...
ALMATH_API void changeReferenceTransposePosition3DInPlace(const Transform &pT, Position3D &pPosOut)