How to get the transform the coordinates of a 3D point from the standard basis to another basis?

405 Views Asked by At

Suppose I have the coordinates of a point in the standard $\mathbb{R}^3$ basis $B_0 = (\vec{e_0}, \vec{e_1}, \vec{e_2})$, with $\vec{e_0} = (1,0,0)$, $\vec{e_1} = (0,1,0)$ and $\vec{e_2} = (0,0,1)$. Let $B_1 = (\vec{u}, \vec{v}, \vec{w})$ be my target coordinate system and $P_{B_0} = (x, y, z)$ the point I want to get the coordinates of in $B_1$. Could anyone explain to me how to do this? This is what I want to achieve (finding $x'$ and $y'$) but in 3D.

3

There are 3 best solutions below

2
On

If you make a matrix $M$ with the basis vectors $u$, $v$ and $w$ as columns. Then you can map from the standard basis to the new one by transforming your vector with $M$.

You can also send vectors from the new basis back to the standard basis by transforming them with $M^{-1}$.

If $M$ happens to be a rotation matrix (as shown in the pictute) then also then $M^T = M^{-1}$

0
On

Let the new coordinates be $(X,Y,Z)$, so that

$$\vec P=X\vec u+Y\vec v+Z\vec w \\=X(u_x\vec e_0+u_y\vec e_1+u_z\vec e_0)+Y(v_x\vec e_0+v_y\vec e_1+v_z\vec e_0)+Z(w_x\vec e_0+w_y\vec e_1+w_z\vec e_0)$$

at the same time that $$\vec P=x\vec e_0+y\vec e_1+z\vec e_2.$$

By identification,

$$\begin{cases}Xu_x+Yv_x+Zw_x=x, \\Xu_y+Yv_y+Zw_y=y, \\Xu_z+Yv_z+Zw_z=z. \end{cases}$$

Now you can express the new coordinates as a function of the old ones by solving the $3\times3$ system.

0
On

After testing my program with a few examples, I might have found the solution based on one of the comments to my original post. I have the standard $\mathbb{R}^3$ basis $B_0 = (\vec{e_0}, \vec{e_1}, \vec{e_2})$, with column vectors $\vec{e_0} = (1,0,0)$, $\vec{e_1} = (0,1,0)$ and $\vec{e_2} = (0,0,1)$ as the source coordinate system ($O$ being its origin) and $B_1 = (\vec{u}, \vec{v}, \vec{w})$ as the target coordinate system ($\Omega$ being its origin) with $\vec{u}$, $\vec{v}$ and $\vec{w}$ that are known. In order to get the coordinates $x'$, $y'$ and $z'$ of point $P(x, y, z)$ within coordinate system $B_1$, follow these steps:

  1. Translate the point with $-(\vec{O\Omega})$ (would correspond to considering that the target coordinate system has its origin in $O$).
  2. Calculate the the rotation angles between each axis of the source system and its corresponding axis in the target system, knowing that $\angle(\vec{u},\vec{v}) = \arccos(\cos(\angle(\vec{u}, \vec{v}))$ and $\cos(\angle(\vec{u}, \vec{v})) = \frac{\vec{u} \cdot \vec{v}}{||\vec{u}|| \cdot ||\vec{v}||}$.
  3. Apply successive $x$, $y$ and $z$ rotations to the translated point using previously obtained angles.

Let me know of any inaccuracies that may have been posted above.