#### Archived

This topic is now archived and is closed to further replies.

# Quaternions/Euler (not the usual question)

This topic is 5985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''ve recently discovered the evil gimbal lock and a way to avoid it : quaternions. The problem I have is that in order to work properly, quaternions have to be built in an incremental way. If I do : (case A) - convert Euler angles to quaternions - convert convert quaternions to matrix It doesn''t work, so I do this : (case B) - take the last object''s quaternion, - multiply it by the "additionnal rotation" - get the new matrix. This work fine if the object''s rotation is created based on the last one. But now, how can I avoid gimbal lock if the user "set" the three Euler angles. Let''s say the user have some kind of form, fill it with the three new Euler angles to apply to the object. The last object''s quaternion is just useless and I''m stuck with the case A. Does anyone know a solution to this problem ?

##### Share on other sites
You should define a set of coordinate axes for each object. Then allow the user to set Euler angles for rotation about these axes. Then you can convert these Euler angles into a quaternion, which can be done where the order of the angles doesn''t matter. Finally, convert the axis of this quaternion into the space defined by the local coordinate axes of the object and you will have a new quaternion that can be used to rotate the object.

##### Share on other sites
One more thing, when you rotate the object with the new quaternion, also rotate its local axes so you can repeat the whole process with a set of new Euler angles.

##### Share on other sites
quote:
Original post by gtdelarosa
Finally, convert the axis of this quaternion into the space defined by the local coordinate axes of the object...

Sorry for being stupid but how must I do this ?

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632983
• Total Posts
3009706
• ### Who's Online (See full list)

There are no registered users currently online

×