Get Y and Z axes from X axis

1.3k Views Asked by At

I'm trying to figure out how to translate points from one coordinate system to the another. I need to go from the standard 3d coordinate system to a coordinate system with the x axis $u = <x, y, z>$. I've managed to get the transformations working for 3 arbitrary axes, but what I can't seem to do properly is get the y and z axes from $u$.

I think I have to swap around the $x$, $y$, and $z$ of $u$ and negate them, but I can't seem to figure out the right way to do it.

Essentially, given a vector defining the X axis $X = <x, y, z>$, I want to find the vectors $Y$ and $Z$ defining the Y and Z axes.

(I also think that the solution here could produce 2 answers, since Y and Z could be arbitrarily swapped, but I'm not sure. For my purposes, I don't think it matters).

Thanks for any help!

2

There are 2 best solutions below

1
On BEST ANSWER

You need to have the new specific system.

With only x you can find a infinite set of pair (y, z). It is a plane, perpendicular with x.

Without specific y and z you can't define specific coordinates of a point in the new system. In other words, you can't do transformation.

Solution: You need at least a pair of(x, y) or (x, z) or (y, z) to find the third using cross product.

0
On

There is a long method in my mind, but maybe there is a shorter one also.

You have to get 2 angles first, the angle $\theta_1$ between the $x$-axis and the projection of the vector $X$ on the $Oxy$ plane (lets call it $X'=(x,y,0)$) and the angle $\theta_2$ between $X$ and $X'$. (You can get the 2 angles using the dot product).

Now all what you have to do to get the vector $Y$ is rotating the $y$-axis by the same angles, i.e. rotate it by angle $\theta_1$ in the $Oxy$ plane, and then by angle $\theta_2$ towards the $z$-axis.

Finally by doing the cross product of $X$ and $Y$ you'll get $Z$.

Note that the order is important, the system $X,Y,Z$ is called a direct orthosystem, which mean that the angles $(X,Y)=(Y,Z)=(Z,X)= \text{ $+\frac{\pi}{2}$}$