Translations or relative positions can also be represented by vectors of dimension 3. In this case the vector represents the new position relative to the old position. These translations can be concatenated (applied one after another), this can be represented mathematically by adding the vectors. So if a translation [ax, ay, az] is applied and then another translation [bx, by, bz] the resulting translation will be [ax+bx, ay+by, az+bz]. The usual rules of vector addition apply, so:
[A] + [B] = [B] + [A]
in 3 dimensions:
|
+ |
|
= |
|
+ |
|
= |
|
A complex object can be translated by applying the translation to each point on the object.
Since there are 3 dimensions this gives 3 degrees of freedom.
These translations can be used to describe the linear movement of an object.
Representing Translation in program
Translation in 3D space can be held in a 3D vector (see class sfvec3f). For an example of how this might be used in a scenegraph node, see here.