4

On the Wolfram|Alpha website, I type quaternion(1,1,1,1) into the search field. Wolfram|Alpha shows a 3D transformation of the quaternion values representing the orientation of an object.

I have 9 more quaternion values other than quaternion(1,1,1,1).

I would like to ask how can I visualize the 3D transformation of the remaining 9 quaternion values, but without using the Wolfram|Alpha website and opening 9 more tabs and keying in the additional values into search fields.

I hope, rather, to write a Mathematica program to demonstrate rotation according to my 10 quaternion values. Every rotation will take 1 second, so in total the demonstration will take 10 seconds for all 10 rotations.

Can anyone help me how I can write the code for my proposed demonstration?

Michael E2
  • 235,386
  • 17
  • 334
  • 747

1 Answers1

4

Kind of a part answer: It is quite easy to convert a quaternion to a Mathematica RotationMatrix. First normalize the quaternion. The first element will then be the cosine of half the rotation angle. The last 3 elements together describes the axis of rotation.

q = Normalize@{1, 1, 1, 1}
rm = RotationMatrix[2 ArcCos[First@q], Rest@q]
hmilton
  • 376
  • 1
  • 6