# Blog post about deriving rotation matrices

5 replies to this topic

### #1Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 18 September 2011 - 06:32 PM

I wrote a blog post about rotation matrices and how they can be derived using a mathematical technique called an "infinitesimal generator", and I use it to figure out the nasty formula for axis-angle rotations from first principles. Maybe some people here will be interested in this...warning, heavy mathematics ahead! :yes:
reedbeta.com - developer blog, OpenGL demos, and other projects

### #2roel

Senior Member

• Members
• 698 posts

Posted 18 September 2011 - 06:46 PM

Great!

### #3geon

Senior Member

• Members
• 939 posts

Posted 18 September 2011 - 08:34 PM

Cool!

Just a question; In what situation would a axis-and-angle be a suitable representation of a rotation?

I usually store quaternions, since they are easy to use, and use angle-axis for input since they are easy to visualize.

http://en.wikipedia....on_(mathematics)

### #4Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 18 September 2011 - 09:02 PM

Yes, quaternions have several advantages as an internal representation of rotation for a physics engine or computer graphics. The axis-angle thing was more of an exercise to demonstrate what you can do with infinitesimal generators. Although, for angular velocity one usually uses a vector whose direction is the axis and length is the rotation speed, as the dynamics equations are easier that way. That's kind of like axis-angle.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #5.oisyn

DevMaster Staff

• Moderators
• 1842 posts

Posted 18 September 2011 - 09:46 PM

Another way to derive the rotation matrix is using quaternions. A quaternion multiplication can be rewritten into a multiplication of a matrix and a quaternion as vector4. And since a point p rotated by quaternion q can be calculated by doing q∙quat(0, p)∙q-1, you can figure out the rotation matrix.
-
Currently working on: the 3D engine for Tomb Raider.

### #6}:+()___ (Smile)

Member

• Members
• 169 posts

Posted 19 September 2011 - 12:14 PM

The same infinitesimal math can be applied to quaternions. Generator of quaternion rotation about axis identified by unit vector n is
[indent]G = quat(0, n) / 2.[/indent]
So, for finite angle a, quaternion of rotation equals
[indent]q = exp(Ga) = quat(cos(a / 2), n sin(a / 2)).[/indent]
Sorry my broken english!

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users