Derive Rigid Transform Matrix from Axes and Origin

545 Views Asked by At

I'm trying to derive the matrix of a rigid transform to map between two coordinate spaces. I have the origin and the axis directions of the target coordinate space in terms of the known coordinate space; does anyone know how I can solve for the 4x4 rigid transformation matrix given these?

So, in other words, I have two coordinate spaces, A and B, and I know

Point3D originOfBInA;
Vector3D xAxisOfBInA; // Unit vector
Vector3D yAxisOfBInA; // Unit vector
Vector3D zAxisOfBInA; // Unit vector

And I'm trying to find the 4x4 matrix $\quad$

Matrix4x4 AtoB;
1

There are 1 best solutions below

2
On

Let $e_1, e_2, e_3$ be a basis of coordinate space $A$. Express your given vectors (xAxisOfBInA, etc..) in terms of the basis of A, lets label them as column vectors $v_1, v_2, v_3$.

Then coordinate transform matrix is $C = \pmatrix{v_1 & |& v_2 &|& v_3}$. But since you are shifting the origin, you are doing a 3D affine transform, which can be represented as a 4D linear transform.

Represent coordinates $(x,y,z) \in A$ as $\vec{x} = (x,y,z,1)$. Then the representation of $\vec{x}$ in $B$ is $D\vec{x}$, where $D = \pmatrix{C & x_0 \\ 0 & 1}$, where $x_0$ is the representation of originOfBInA in terms of the basis of $A$.

If this is too abstract, I can work out an example if you'd like.