3
$\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$

1 Answer 1

7
$\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$
4
  • 1
    $\begingroup$ TransformtionFunction works the same: 'TransformationFunction[ RotationMatrix[[Pi]/3, Normalize[{0, 0, 1}]]] == RotationTransform[Pi/3]' $\endgroup$
    – bill s
    Commented Sep 29, 2018 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$ Commented Sep 29, 2018 at 13:42
  • $\begingroup$ The role of the Normalize[0,0,1] is exactly the augmentation, just as with AffineTransform $\endgroup$
    – bill s
    Commented Sep 29, 2018 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$ Commented Sep 29, 2018 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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