Calculating the location of a point relative to another origin

3dlinear-transformationsrotations

There are two sources of 3-dimensional coordinates, the second source can be traversed from the first origin at any angle and direction, and we also have a point with its coordinates relative to the second origin, the question is the coordinates of this point relative to the first origin.

image is here

Best Answer

With respect to rotation part, assuming from your picture that coordinate frames are made by three orthonormal vectors, transforming vectors from frame $\mathbf F$ to frame $\mathbf G$ is about solving a $3 \times 3$ linear system.

Define two $3 \times 3$ matrices $F = [ f_1, f_2, f_3 ]$ and $G = [ g_1, g_2, g_3 ]$ where the columns $f_i$ are the vectors of frame $\mathbf F$ and the columns $g_i$ are the vectors of frame $\mathbf G$

Then the matrix $F G^{-1}$ send vectors from frame $\mathbf G$ to frame $\mathbf F$:

$F G^{-1} g = f$

And the matrix $G F^{-1}$ send vectors from frame $\mathbf F$ to frame $\mathbf G$:

$G F^{-1} f = g$

Since you are interested also in translation, you need to extend the matrices $F$ and $G$ to be $4 \times 4$ and work with homogeneous coordinates instead of Euclidean vectors i.e., work with 3D vectors embedded in 4D space.

See: https://en.m.wikipedia.org/wiki/Homogeneous_coordinates

Once you have defined your $4 \times 4$ matrices the mappings defined above still works for mapping vectors between frames $\mathbf F$ and $\mathbf G$.

Related Question