2
$\begingroup$

Is it possible to convert RotationMatrix to RotationTransform ? I guess it should exist a function to do this

Thank you for your help

$\endgroup$
5
$\begingroup$

One only needs to apply AffineTransform[] to the result of RotationMatrix[]; e.g.

AffineTransform[RotationMatrix[π/3, Normalize[{1, 2, 3}]]] ===
RotationTransform[π/3, Normalize[{1, 2, 3}]]
   True

An additional advantage to using AffineTransform[] is that one can put in other classes of rotation matrices, instead of just RotationMatrix[]; e.g. AffineTransform[RollPitchYawMatrix[{-π/4, π/6, 3 π/5}]] or AffineTransform[EulerMatrix[{π/2, -π/5, 2 π/3}]].

$\endgroup$
  • 1
    $\begingroup$ TransformtionFunction works the same: 'TransformationFunction[ RotationMatrix[[Pi]/3, Normalize[{0, 0, 1}]]] == RotationTransform[Pi/3]' $\endgroup$ – bill s Sep 29 '18 at 13:23
  • $\begingroup$ @bill, since TransformationFunction[] takes a homogeneous transformation matrix as an argument, in general one needs to augment the starting matrix beforehand. $\endgroup$ – J. M. will be back soon Sep 29 '18 at 13:42
  • $\begingroup$ The role of the Normalize[0,0,1] is exactly the augmentation, just as with AffineTransform $\endgroup$ – bill s Sep 29 '18 at 18:21
  • $\begingroup$ Right; RotationMatrix[π/3, Normalize[{0, 0, 1}] effectively says "rotate by $\pi/3$ radians anticlockwise over the $z$-axis", which does correspond to a rotation in the $x$-$y$ plane. $\endgroup$ – J. M. will be back soon Sep 29 '18 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.