0
$\begingroup$

I need to rotate with the Euler angle sequence:

  1. Yaw by $\psi$ around $z$
  2. Pitch by $\theta$ around $y'$
  3. Roll by $\phi$ around $x''$

I know of Rotate[] in Mathematica, but I do not see an Euler angle option for it. I need to eventually have something like the pseudo-code below:

Graphics3D[Translate[Rotate[object3D,psi,theta,phi],{x,y,z}]]

Thank you!

$\endgroup$
3
  • 3
    $\begingroup$ Did you search the documentation for "Euler angles"? Did it come up with something? Maybe "rotation"? Learning to the use the docs is a valuable skill. $\endgroup$
    – chuy
    Aug 3, 2015 at 19:47
  • $\begingroup$ @chuy Thanks, I found the answer from documentation. $\endgroup$ Aug 3, 2015 at 20:30
  • $\begingroup$ As a historical note: the old Geometry`Rotations` package used to use Euler angles instead of pitch-roll-yaw. But as noted by @chuy, the conversion formulae are in fact in the docs. $\endgroup$ Aug 4, 2015 at 0:18

1 Answer 1

2
$\begingroup$

I found the solution. Here is the source code:

(* Create the Euler rotation matrix *)
yawRotationInv = RotationTransform[ψ, {0, 0, 1}];
pitchRotationInv = RotationTransform[θ, {0, 1, 0}];
rollRotationInv = RotationTransform[ϕ, {1, 0, 0}];
EulerRotate[ϕ_, θ_, ψ_] = Composition[yawRotationInv, pitchRotationInv, rollRotationInv];

Manipulate[Graphics3D[{EdgeForm[None], GeometricTransformation[Cuboid[],
EulerRotate[ϕ, θ, ψ]]}], {ϕ, 0, 
Pi/2}, {θ, 0, Pi/2}, {ψ, 0, Pi/2}]
$\endgroup$

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