logo back up home forward   further reading more topics »

Maths - Axis Angle

Axis and Angle is one possible way to represent the rotation of a solid 3D object. Other representations are:

Description

Rotation can be represented by a unit vector and an angle of revolution about that vector.

Any 3D rotation can be represented in this way, in other words, given a solid object with orientation 1 and the same object with a different orientation 2. Then we can always find an axis and angle which will rotate from orientation 1 to orientation 2.

Which direction of rotation is positive? on this site, we will use the right hand rule.

Axis-Angle is probably one of the most easily understood methods for us to specify 3D rotations. However, be careful, 3D rotations can be counterintuitive in some ways (see box on right of page). One downside of using axis angle to represent 3D rotations is that we can't directly combine two rotations to give an equivalent total rotation, to do that we need to use matrices or quaternions, quaternions are related to axis angle so its not too hard convert between them as explained here. The other downside is that there are two singularities at 0° and 180° where the axis can jump suddenly for a small change in input.

We can also use axis and angle to represent any instantaneous angular velocity as explained here.

Generalisation to other numbers of dimensions

Rotation in 1 dimensional space: we cant rotate in one dimension so that does not apply.

Rotation in 2 dimensional space: we only need the angle, the axis is not needed because we only have one plane to rotate in.

Rotation in 3 dimensional space: as covered on the rest of this page.

Rotation in 4 or more dimensional space:

Any rotation can be represented by projecting the object onto a 2-dimentional plane and then rotating it through an angle. The plane can be defined by a bivector .It happens that, in three dimensions, a bivector is three dimensional, in this case planes (represented by bivectors) and lines (represented by vectors) are duals. This means that, in three dimensions, we can represent the direction of rotation by a line known as the axis. This can be helpful as it can be more intuitive to represent the direction of rotation about an axis rather than in a plane.

sfrotation

On these pages will be developing a class sfrotation (full listing here) which holds a rotation and encapsulates operations such as combining two rotations, in addition to coding the rotation as a quaternion it can also be coded as euler or axis angle and can convert between these formats.

Sample Rotations

In order to try to explain things I thought it might help to work out a simple case where rotations are only allowed in multiples of 90°. This should make it easier to illustrate the orientation with a simple aeroplane figure, we can rotate this either about the x,y or z axis as shown here:

When we combine these rotations about the x,y and z axis in 90° multiples there are 24 possible orientations as shown here:

Axis-angle in all the rows below represents the rotation from the top left (reference orientation) to the position in the box concerned.

heading applied first giving 4 possible orientations:

reference orientation

angle = 0°
axis = 1,0,0

rotate by 90° about y axis

angle = 90°
axis = 0,1,0

rotate by 180° about y axis

angle = 180°
axis = 0,1,0

rotate by 270° about y axis

angle = 90°
axis = 0,-1,0

or

angle = -90°
axis = 0,1,0

Then apply attitude +90° for each of the above: (note: don't forget that all these axis-angle values are with repect to the reference orientation in the top row).

angle = 90°
axis = 0,0,1

angle = 120°
axis = 0.5774,0.5774,0.5774

angle = 180°
axis = 0.7071,0.7071,0

angle = 120°
axis = -0.5774,-0.5774,0.5774

Or instead apply attitude -90° (also a singularity):

angle = 90°
axis = 0,0,-1

(equivalent rotation to:
angle = -90°
axis = 0,0,1)

angle = 120°
axis = -0.5774,0.5774,-0.5774

angle = 180°
axis = -0.7071,0.7071,0

angle = 120°
axis = 0.5774,-0.5774,-0.5774

Normally we don't go beyond attitude + or - 90° because these are singularities, instead apply bank +90°:


angle = 90°
axis = 1,0,0

angle = 120°
axis = 0.5774,0.5774,-0.5774

angle = 180°
axis = 0,0.7071,-0.7071

angle = 120°
axis = 0.5774,-0.5774,0.5774

Apply bank +180°:


angle = 180°
axis = 1,0,0

angle = 180°
axis = 0.7071,0,-0.7071

angle = 180°
axis = 0,0,1

angle = 180°
axis = 0.7071,0,0.7071

Apply bank -90°:


angle = 90°
axis = -1,0,0

(equivalent rotation to:
angle = -90°
axis = 1,0,0)

angle = 120°
axis = -0.5774,0.5774,0.5774

angle = 180°
axis = 0,0.7071,0.7071

 

angle = 120°
axis = -0.5774,-0.5774,-0.5774

encoding of these rotations in quaternions is shown here.
encoding of these rotations in matrices is shown here.
encoding of these rotations in euler angles is shown here.

Further Reading

You may be interested in other means to represent orientation and rotational quantities such as:

Or you may be interested in how these quantities are used to simulate physical objects:


metadata block
see also:
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Mathematics for 3D game Programming - Includes introduction to Vectors, Matrices, Transforms and Trigonometry. (But no euler angles or quaternions). Also includes ray tracing and some linear & rotational physics also collision detection (but not collision response).

Other Math Books

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

cover Dark Basic Professional Edition - It is better to get this professional edition

cover This is a version of basic designed for building games, for example to rotate a cube you might do the following:
make object cube 1,100
for x=1 to 360
rotate object 1,x,x,0
next x

cover Game Programming with Darkbasic - book for above software

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

Can anyone help me prove any rotation can be represented in this way?

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved - privacy policy.