index

A convention for describing transforms

2023-03-25 -- 2024-01-01

How to talk, write and code in a manner that makes it clear what a linear transform is describing?

Firstly, it helps to have words to differentiate the two ways we can interpret the same transform: Are we interpreting transform as being Passive or Active? A transformation matrix with the notation TLV, can be viewed as either:

To be more clear, we should specify the following about a rotation and translation representation:

Math Notation and How to Describe Them

Here are some useful phrases to help describe quantities and transforms and what they represent.

Vector

tBCA

The vector from B to C expressed in A.

Angular velocity

ωBCA

The angular velocity of frame C as seen from frame B, expressed in frame A.

Transforms

TAB

"The pose of B with respect to A" or "Transforms point from frame B into frame A"

It is also helpful to express even more in writing:

The transformation matrix, TWB, represents the pose of the body frame FB, with respect to the world frame FW, such that a point expressed in the body frame pB, can be transformed into the world frame by pW=TWBpB.

The same phrasing can be used for pure rotations.

Notation in Code

Assuming column-vectors, the standard in Eigen and OpenGL, transforms in code can often look like this:

transformed_point = M * point;

When multiple matrices are being combined, it can become vague and hard to keep track of what is happening. Instead, a clearer way to express this is to name the variables representing transforms as A_from_B and assume that we are looking at them in the passive sense.

This has some nice benefits:

However, this requires you to talk about the transforms in the passive sense. One could use the a_to_b instead of a_from_b formulation for talking about the transforms in the active sense. However, as Sebastian Sylvan describes in their post, the a_to_b names might be better used for when dealing with row-vectors. I'm currently leaning towards assuming passive, if that is the normal case in the code base, and then specifying when I'm talking about a transform in the active sense:

// 2 ways of talking about the same transform
// A_from_B == active_A_to_B 

A_point = A_from_B * B_point // passive
point_at_B = active_A_to_B * point_at_A // active

Ideas here are mainly taken from: