Rotating object using product of two quaternions

In summary, the conversation discusses applying two consecutive rotations using two different quaternion values to rotate a cube. The first rotation uses quaternion q1 and the second rotation uses quaternion q2. The resulting orientation is called orientation_1. The goal is to obtain this same orientation by directly applying the second rotation to the initial cube's orientation. However, using the product of q1 and q2 does not yield the same orientation. The possible reason for this discrepancy is the order of rotation steps, which affects the product order of the quaternions.
  • #1
Nahrawess
1
1
Homework Statement
develop an aplpication on Qt6 that rotates objects using quaternion.
Relevant Equations
product of two quaternion:
q=q1*q2
Hello guys, I'm a newbie.

So I have developped an application that rotates a cube using quaternion.

The initial values of the quaternion are ( w=1.0, x=0.0, y=0.0, z=0.0).

Now I want to apply two consecutive rotation using two different quaternion values:
The first rotation corresponds to this quaternion q1= (w=-0.169757, x=-0.00949828, y=-0.550083, z=0.817619).
The second rotation is applied right after the one above and the quaternion (q2) values are (w=0.542742, x=-0.0784193, y=0.663872, z=-0.508483).

So I get a new orientation of the cube; let's call it orientation_1 which is the result of applying two consecutive rotations.

Now, I want to apply the second rotation (second quaternion) directly to the initial cube's orientation where (w=1.0, x=0.0, y=0.0, z=0.0) and get the same orientation as the orientation obtained after applying two consecutive rotations which I called orientation_1. So I thought about getting the product of the two quaternion q1*q2 and use it to rotate the object however I don't get the same orientation as the one that I got when I applied two consecutive rotation.

I really don't get why I don't get the same orientation.
Can someone please help me.
Thank you All.
 
Last edited:
Physics news on Phys.org
  • #2
Just a guess but order of rotation steps is important so that means your product order must be important too. If your steps are apply A then B to rotate the object then your product must be B*A as in B(A x) = (B*A) x

On page 7 of this pdf, it talks about the product of unit quaternions and rotations:

https://graphics.stanford.edu/courses/cs348a-17-winter/Papers/quaternion.pdf
 
Last edited:
  • Like
Likes vanhees71

FAQ: Rotating object using product of two quaternions

What is a quaternion?

A quaternion is a mathematical concept used to represent rotations in three-dimensional space. It is a four-dimensional complex number that can be expressed as a combination of a scalar and a vector.

How do quaternions represent rotations?

Quaternions use a combination of a scalar and a vector to represent a rotation in three-dimensional space. The scalar component represents the rotation angle, while the vector component represents the axis of rotation.

Why use quaternions to rotate objects?

Quaternions are preferred for rotating objects because they do not suffer from gimbal lock, a problem that occurs when using other rotation representations such as Euler angles. Quaternions also have a simpler mathematical representation and are more efficient for computer calculations.

How do you rotate an object using quaternions?

To rotate an object using quaternions, you need to multiply the object's current orientation quaternion by the rotation quaternion. This results in a new orientation quaternion that represents the object's rotated position.

Can quaternions be used for other transformations besides rotations?

Yes, quaternions can also be used for other transformations such as scaling and translation. However, they are primarily used for rotations in three-dimensional space.

Back
Top