# Quaternions

## Recommended Posts

nielzzz    140
So after some searching I found out why rotation matrices(euler) work the way they do. But I can't seem to find any resources that do the same for quaternions. Like: [ cos(theta) -sin(theta) 0] [ sin(theta) cos(theta) 0] [ 0 0 1] Is a rotation matrix about the z-axis. I found alot of info on the net on how to use it, not so much on why it works. Eventually this post explained: http://www.gamedev.net/community/forums/topic.asp?topic_id=286454 Im looking for an explanation just like that but for a rotation quaternion. Q = (cos(theta/2), rx sin(theta/2), ry sin(theta/2), rz sin(theta/2)) I found alot of articles explaining how to do math with them, how they avoid grimbal lock and that the above can be used for rotating. And I can see that if I multiply my point with the above quaternion that it works, but why? :D Can someone please point me in the right direction?

##### Share on other sites
swiftcoder    18437
Quote:
 Original post by nielzzzSo after some searching I found out why rotation matrices(euler) work the way they do. But I can't seem to find any resources that do the same for quaternions.
Matrices are fairly straightforward, and the mathematics behind them is elementary. The same is unfortunately not true for Quaternions, which are something of a mathematical oddity.

If you don't mind my asking, how strong is your mathematical background? A decent grasp of complex numbers would be very handy before you dive into quaternions.

The wikipedia page has a fair amount of information about the mathematics of quaternions, but as with all of wikipedia, it is a little hit-or-miss as to clarity. That page does however offer a lot of links and references, some of which are very detailed.

##### Share on other sites
nielzzz    140
My math background is from high school :)

But I did some research on complex numbers, and I found out that the original reason for the creation of quaternions was for an extension of complex numbers into 3d.

I also found out that it wasn't until later that it was found that quaternions were also useful for rotation in 3d.

I can't see the link between complex numbers and rotating a point around an vector, do you ever need the square of a negative number?. Also if I look at the rotation quaternion the complex numbers(i) are just replaced by sin(theta/2). Wich leads me to think that the rotation quaternion just uses the math "rules" from the quaternions, but has a basic explanation. No? :p

##### Share on other sites
swiftcoder    18437
Quote:
 Original post by nielzzzI can't see the link between complex numbers and rotating a point around an vector, do you ever need the square of a negative number?. Also if I look at the rotation quaternion the complex numbers(i) are just replaced by sin(theta/2). Wich leads me to think that the rotation quaternion just uses the math "rules" from the quaternions, but has a basic explanation. No? :p
I actually directed you to the wrong page before, I intended to send you to this one, which has a much better explanation of quaternions as applied to rotations.

##### Share on other sites
nielzzz    140
Thanks I'm fully understanding quaternions now

I found wiki to be unnecessary confusing/complex.
But an external link on the wiki page you provided had a basic high school explanation about how quaternions work. Just what I was looking for.

For anyone who is interested it makes it all VERY simple:
http://www.itk.org/CourseWare/Training/QuaternionsI.pdf

In fact the word complex(number) is not even mentioned once! :D

##### Share on other sites
leiavoia    960
thanks for the link, nielzzz. I was just browsing this topic and read over that. I'm stashing that one away for sure! It's even better than what's the 3D Math Primer book.

## Create an account

Register a new account