#### Archived

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

# Quaternions vs. Euler Angles vs. vector and angle

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

## Recommended Posts

Been hearing lots about Quaternions and I wanted to know why they are used so frequently. Is it just because they help prevent gimble lock or are they also more efficient? I have looked at some of the Quaternion articles on gamedev but I think these articles jump into things a bit too quickly for me. I would rather understand how Quaternions came about and then get into the math. Anyone know a good link or have any ideas on this matter? Thanks in advance.

##### Share on other sites
quote:
Original post by Zaxxon21
Been hearing lots about Quaternions and I wanted to know why they are used so frequently. Is it just because they help prevent gimble lock or are they also more efficient?

Yes and Yes.

Quats have 4 components x,y,z,w, matrices have 9. therefore multiplying two quats is more efficient than multiplying 2 matrices. So if you are rotating hundreds of objects per frame then it is more efficient.

quote:
Original post by Zaxxon21
I would rather understand how Quaternions came about and then get into the math. Anyone know a good link or have any ideas on this matter?

http://www.maths.tcd.ie/pub/HistMath/People/Hamilton/Quatern2/Quatern2.html

D.V.

Carpe Diem

##### Share on other sites
Thanks for the reply, I''m at work at the momment, so I''ll check it out when I get home in a few hours.

Does anyone know of any decent math/algorithm books for game programming?

##### Share on other sites
Have you seen code from a big programming project? And you notice the same thing gets cut and pasted over and over. The 5th guy down the line just cuts and pastes what some other guy already did without thinking about why he did it. In my opinion this analogy applies to quaternions.

Before you blindly just "cut and paste" by using quaternions do some reading. They are not the magic bullet of 3d engines. Personally, I think maintaining an axis of rotation and angle is much better. For starters, why do you need to multiply two matrixes? If I wish to rotate the vector <1 1 0.5> about the axis of rotation < 0 1 0> there is only one matrix involved, and the vector in question. BUT although I am new to gamedev''s forums I would imagine this has been debated over and over again and I am not trying to re-light the fire, my point to Zaxxon21 is:

Before you choose either method, carefully read up on quaternions and your linear algebra, then make an informed decision.

super genius

##### Share on other sites
quote:
Original post by duke
For starters, why do you need to multiply two matrixes? If I wish to rotate the vector <1 1 0.5> about the axis of rotation < 0 1 0> there is only one matrix involved, and the vector in question.

There are many reasons to multiply two matrices. If you have two matrices M1 and M2 that represent rotations, then multiplying them gives you a matrix M3 that represents both rotations. If you''re transforming a bunch of vectors it''s going to be much more efficient to multiply them just by M3 than by both M1 and M2.

quote:
Original post by DeltaVee
Quats have 4 components x,y,z,w, matrices have 9. therefore multiplying two quats is more efficient than multiplying 2 matrices. So if you are rotating hundreds of objects per frame then it is more efficient.

That''s not really accurate. Multiplying two quaternions is faster because it involves fewer multiplications and additions, not because it has fewer components. That doesn''t necessarily mean it''s faster to rotate lots of objects.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632651
• Total Posts
3007647
• ### Who's Online (See full list)

There are no registered users currently online

×