Maths - Combined Rotation and Translation

Prerequisites

How can we combine rotations and translations without using matrices?

If you are not familiar with this subject you may like to look at the following pages first:

Combined Rotation and Translation

In VRML and related standards there is the concept of a transform group. This is a node in a scenegraph which contains the following parameters:

center="0 0 0"
rotation="0 0 1 0"
scale="1 1 1"
scaleOrientation="0 0 1 0"
translation="0 0 0"

To simplify things at this stage assume that the node contains only:

center="0 0 0"
rotation="0 0 1 0"
translation="0 0 0"

Rotation about a Point

Here we cover the rotation about a point (not necessarily the origin). This can be solved using matrix methods as shown here.

First as a comparison consider a rotation about the origin.

Now imagine the same object being rotated by the same angle, but about point P.

Where:

So the angle of rotation is the same whatever point we rotate about, but if we rotate about a point other than the origin this will translate the centre of the object by C - R(C).

Rotating Sum of two points

What is the effect of applying the rotation function R() to the sum of two points?

What this diagram is trying to show (I realise that the diagram is a bit messy) is that if:

Point P1, in absolute coordinates, is rotated to point R(P1) in local coordinates.

Point P2, in absolute coordinates, is rotated to point R(P2) in local coordinates.

Then:

Point P1+P2, in absolute coordinates, is rotated to point R(P1+P2) in local coordinates.

So:

R(P1+P2) = R(P1) + R(P2)

Transforms

Let us take a transform with the following parameters:

To calculate the total transform in terms of these parameters, we need to first shift the centre of rotation to the origin, then rotate, then shift back to the original centre.

So first shift C to origin:

Pabsolute = Plocal - C

Now rotate about origin:

Pabsolute = R(Plocal - C)

Now move back to original point:

Pabsolute = R(Plocal - C) + C

Now add the translation:

Pabsolute = R(Plocal - C) + C + T

The terms in the rotation function can be spilt up as described in 'Rotating Sum of two points' above.

Pabsolute = R(Plocal) - R(C) + C + T

Combining Transform Nodes

What is the combined effect of putting one transform node under another:

It is possible to find the resulting transform in terms of a 4x4 matrix. But what is an equivalent Transform node that will have the same effect as the two nodes above:

For on level of transform we have seen that the absolute position is given by:

Pabsolute = R(Plocal - C) + C + T

To cascade more than one of these we can calculate the position in coordinates of layer 'n' from the position in the coordinates of the layer below:

Pn-1 = Rn(Pn - Cn) + Cn + Tn

where:

So Pabsolute = Ra(Pa - Ca) + Ca + Ta
and Pa = Rb(Pb - Cb) + Cb + Tb

where:

So substituting the Pa from the second equation into the first gives:

Pabsolute =Ra(Rb(Pb - Cb) + Cb + Tb - Ca) + Ca + Ta

Expanding out gives:

Pabsolute =Ra Rb(Pb - Cb) +Ra (Cb + Tb - Ca) + Ca + Ta

We want to put this into this format:

Pabsolute = Rt(Pb - Ct) + Ct + Tt

where:

so to make this equivalent to the two separate rotations makes:

So we rotate around a point which is equal to the centre of rotation of the first level rotation, but we have to adjust the translation by a factor which depends on the absolute rotation.

Example 1

Imagine that we are implementing a trackerball control. To do this we are translating an object in a transform under another transform, the lowest level transform rotates everything by 45 degrees. We pull the object across the screen and we want it to move across the screen but how do we correct for the bottom transform.

We are setting the lowest level transform: but we want it to be equivalent to the following
equivalent total translation = Ra (Tb) equivalent total translation = Tin

Therefore Tb = Ra'(Tin)

In other words we apply the inverse rotation to the input translation which is minus 45degrees.

Example 2

As example 1 but with translation and off-centre..

We are setting the lowest level transform: but we want it to be equivalent to the following
equivalent total translation = Ra (Tb - Ca) + Ca + Ta equivalent total translation = Ta + Tin

Therefore Ra (Tb - Ca) + Ca + Ta = Ta + Tin

Ra (Tb - Ca) + Ca = Tin

Tb = Ra'(Tin - Ca) + Ca

Scaling, Translation and Rotation.

We now want to add scaling to the following parameters:

We add the following two parameters:

The position in terms of local position is:

Pabsolute = R(SR(S × SR'(Plocal-C))) + T + C

Combining Transform Nodes with Scale

What is the combined effect of putting one transform node under another:

 
 

For on level of transform we have seen that the absolute position is given by:

Pabsolute = R(SR(S × SR'(Plocal-C))) + T + C

To cascade more than one of these we can calculate the position in coordinates of layer 'n' from the position in the coordinates of the layer below:

Pn-1 = Rn(SRn(Sn × SRn'(Pn-Cn))) + Tn + Cn

where:

So Pabsolute = Ra(SRa(Sa × SRa'(Pa-Ca))) + Ta + Ca
and Pa = Rb(SRb(Sb × SRb'(Pb-Cb))) + Tb + Cb

where:

So substituting the Pa from the second equation into the first gives:

Pabsolute =Ra(SRa(Sa × SRa'((Rb(SRb(Sb × SRb'(Pb-Cb))) + Tb + Cb)-Ca))) + Ta + Ca

Can anyone help me expand this out and find an equivilant single transform??

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 Robot Dynamics Algorithms (Kluwer International Series in Engineering and Computer Science, 22)

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

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

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