I have a quaternion which represents a 3D object rotation, for example:
Quaternion(scalar:0.707107, vector:(0, 0, 0.707107))
I want to keep the current 3D object rotation, but add an extra rotation to it, for example:
Extra rotation to be added to quaternion:
Rotate around point (34.5, -40, 0.0) in XY plane by 180°
I cannot figure out how to convert my extra rotation to a quaternion and add it to the previous quaternion. Can anybody give me a hint?
Answer provided on a mailing list:
Hi,
convert your rotation to a quaternion and multiply both quaternions to get a quaternion representing both rotations. Note that quaternion multiplication is not commutative.
See these links for some handy explanations and shortcuts https://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm https://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm
-Marian
Another answer on a mailing list:
Just for clarification: A quaternion does not describe a "rotation around point", but just a rotation in 3D.
If you want to rotate around a given point, you first have to apply a translation to the origin, then the rotation (which might be given as a quaternion) and then a translation back to the intended rotational centre.
Cheers, Rainer