I want to rotate a form with three given angles fo each of the three axis. But the GLM rotation function takes only one angle and a vector as arguments.
How can I convert between both formats?
|
|
|
GLM's rotation function uses Euler's rotation theorem, which implies that any rotation or sequence of rotations of a rigid body in a three-dimensional space is equivalent to a pure rotation about a single fixed axis. However consecutive calls to GLMs rotate function just multiply the rotation so rotating a rigid body by Yaw, Pitch, Roll is as simple as this:
Edit: please also read this article where they explain the differences and how you can go from Euler angles to Quaternions to Axis Angle :) |
||||
|
|
|
The angles used to build a rotation for each of the three axes are known as Tait-Bryan angles (often confused with Euler angles). Wikipedia has all the formulas you need to convert Euler or Tait-Bryan angles into a rotation matrix. Here is some code to build a rotation matrix from three Tait-Bryan angles and the order of the rotations:
|
||||
|
|