General Comments on Coordinate Transforms

This document explains how coordinate systems and coordinate transforms are defined; sets out the conventions used to describe coordinate transforms; presents the transformation rules for spatial and planar quantities; and says a few words about the difference between a coordinate transform and a displacement operator.

The elementary functions in Spatial_v2 deal with four different kinds of coordinate system: Cartesian coordinates for 2-D and 3-D points and Euclidean vectors, Plücker coordinates for spatial vectors, planar coordinates (a subset of Plücker coordinates) for planar vectors, and homogeneous coordinates for points in 3-D space.  (Homogeneous coordinates appear only in the function pluho, which converts between Plücker and homogeneous coordinate transforms.)  These coordinate systems all have one thing in common: they are defined by the location of a Cartesian coordinate frame.  Specifically, a Cartesian coordinate system for vectors (not points) is defined by the orientation of its coordinate frame; but Plücker, planar and homogeneous coordinates, as well as Cartesian coordinates for points, are all defined by the position and orientation of their coordinate frame.  Furthermore, the relationship between a coordinate system and its frame is 1:1.  So, for example, the set of all Plücker coordinate systems stands in 1:1 correspondence with the set of all positions and orientations of a Cartesian frame in 3-D space.  (Various descriptions of Plücker coordinates can be found on the spatial vectors home page.)

Given this close connection between frames and coordinate systems, it becomes convenient to use the same name to identify both the frame and the coordinate systems it defines.  For example, a 3-D coordinate frame A defines both a 3-D Cartesian coordinate system A and a Plücker coordinate system A.  Any possibility of ambiguity can be removed simply by identifying the type of vector under discussion.  For example, in a statement like '…spatial velocity v expressed in A coordinates…' it is clear that 'A coordinates' must refer to the Plücker coordinate system defined by frame A.

The purpose of a coordinate vector is to represent some physical quantity or phenomenon in a particular coordinate system.  For example, if we say that a rigid body has a spatial velocity of v, and that vA is the coordinate vector representing v in A coordinates, then the symbol v denotes an actual state of physical motion, whereas vA denotes a 6x1 matrix (i.e., a column vector) of real numbers.  On the one hand, v is unique because its value is the actual physical motion of a rigid body, and a rigid body can have only one state of motion at any given instant.  On the other hand, vA can have infinitely many different values, depending on the location of frame A, because it is just a list of six numbers that represent the state of motion indirectly via the basis vectors of A coordinates.  Thus, v is the name of an actual state of motion, and vA is the name of a 6x1 matrix.  (In RBDA, v is called an abstract vector.)

Let vA and vB be coordinate vectors representing the same physical quantity v in A and B coordinates, respectively.  The coordinate transform from A to B coordinates is then defined to be the matrix X that satisfies vB = X * vA for all v.  The value of X depends only on the location of frame B relative to frame A, and on the type of vector being transformed.  The easiest way to describe the relative location of B is to state the sequence of rotations and translations that will get you from A to B; that is, the sequence of self-rotations and self-translations of a coordinate frame that is initially coincident with frame A, such that it ends up coincident with frame B.  Another way to think of it is a description of the journey from A to B.  For example, the function rotx calculates the Plücker coordinate transform from A to B coordinates, in which frame B is rotated relative to frame A by a specified angle about their common x axis; and the function xlt calculates the transform from A to B coordinates, in which frame B is translated by a specified amount relative to A.  Putting the two together, the expression rotx(theta)*xlt(r) calculates the coordinate transform from A to B coordinates, in which frame B is "translated by r and then rotated by theta about its local x axis."  Observe that the description of the journey follows the mathematical expression from right to left: first r, then theta.

Spatial and Planar Coordinate Transform Rules

All Euclidean vectors (of a given dimension) follow the same transformation rule, regardless of whether the vectors represent motions or forces.  However, the same is not true of spatial and planar vectors.  Let m denote a spatial or planar motion vector (such as a velocity, an acceleration or a joint axis); let f denote a spatial or planar force vector (such as a force, an impulse or a momentum); and let mA, mB, fA and fB be coordinate vectors representing m and f in A and B coordinates, respectively.  If X is the coordinate transform from A to B coordinates for motion vectors, and Y is the corresponding transform for force vectors, then the two transformation rules are mB=X*mA and fB=Y*fA, and the relationship between X and Y is Y=X−T, where X−T means (X−1)T.

This difference between the way that motion and force vectors behave has consequences for the matrices representing inertia, stiffness, and other such quantities.  Basically, we find that there are four possible transformation rules, depending on whether the matrix represents something that maps motion to motion, motion to force, force to motion, or force to force.  The table below sets out the various formulae.  There are also consequences for the way the software is organized.  Spatial_v2 adopts the convention that every Plücker or planar coordinate transform that is either returned as a result, or accepted as an argument, is expected to be a coordinate transform for motion vectors.  In the table below, X is the transform from A to B coordinates for motion vectors.

Type Example Coordinate Transform Rules
motion vector     velocity     mB = X*mA     mA = X−1*mB
force vector force fB = X−T*fA fA = XT*fB
motion to force inertia IB = X−T*IA*X−1 IA = XT*IB*X
force to motion inverse inertia ΦB = X*ΦA*XT ΦA = X−1B*X−T
motion to motion crm(v) MB = X*MA*X−1 IA = X−1*MB*X
force to force crf(v) FB = X−T*FA*XT FA = XT*FB*X−T

Displacement Operators

When a matrix is used to translate and/or rotate a coordinate system, it is called a coordinate transform.  When a matrix is used to translate and/or rotate a geometrical object (points, lines, vectors, triangles, etc.), it is called a displacement operator.  Terms like 'rotation operator', 'rotation matrix' and 'translation matrix' are commonly used when the displacement happens to be a rotation about the origin or a pure translation.

The distinction between these two kinds of matrix is important because they are closely related and easily confused (and confusion leads to mistakes).  To illustrate the difference, let u be a Euclidean vector, and let v be the result of rotating u in a certain way.  (So v has the same magnitude as u, but points in a different direction.)  Also, let A and B be any two coordinate frames such that B is rotated relative to A in the same way that v is rotated relative to u.  If E is the coordinate transform from A to B, and R is the displacement operator, then we have uB=E*uA and vA=R*uA.  So E has left the vector alone but rotated the coordinate system, whereas R has left the coordinate system alone but rotated the vector.

In this example, it can easily be shown that R=E−1.  However, this is just a special case of a more general result, which is that a coordinate transform matrix is the inverse of the displacement operator acting on the basis.

Why do you need to know this?  Well, displacement operators are widely used in applications such as 3-D graphics and computer-aided design (CAD).  The 4x4 matrices used in Matlab handle graphics, for example, are displacement operators, and so are the matrices in the Open-GL graphics library.  If you want to interface Spatial_v2 with other software packages then you need to know whether those other packages expect coordinate transforms or displacement operators.

At this point, you might be wondering why Spatial_v2 uses coordinate transforms when displacement operators are so widely used.  The answer lies in the application.  In 3-D graphics, or CAD, the idea is to create geometrical objects; and typically one does this by creating an object in a standard location, and then moving it from where it was created to where it is supposed to be.  Displacement operators are the natural tool for this kind of work.  In dynamics, on the other hand, all the bodies and joints already exist, and are already in their correct positions; and the task is to perform calculations local to each body and combine the results with those from other bodies.  For this kind of work, it is convenient to assign a coordinate frame to each body, and employ coordinate transforms to move data around from one coordinate system to another.


Page last modified:  June 2012
Author:  Roy Featherstone