# transformation of 3D coordinate system

how to transform a cylinder from a coordinate system having orthogonal basis vectors $v_1$, $v_2$ and $v_3$ into another a coordinate system having orthogonal basis vectors $\begin{pmatrix}1\\0\\0\end{pmatrix}$, $\begin{pmatrix}0\\1\\0\end{pmatrix}$ and $\begin{pmatrix}0\\0\\1\end{pmatrix}$.

-

## migrated from stackoverflow.comFeb 9 '12 at 22:04

This question came from our site for professional and enthusiast programmers.

An example would help. –  Dan W Feb 9 '12 at 18:29
So would a better formed question. Are you asking about a rotation of a coordinate system? –  ldigas Feb 9 '12 at 19:42
Your question literally asks how to transform a cylinder into a coordinate system. :-\. –  Zéychin Feb 9 '12 at 22:29

Make a Rotation Matrix from the vectors $u$, $v$ and $w$ by arranging them in columns such that:

$$R=\begin{pmatrix}u&v&w\end{pmatrix}=\begin{pmatrix}u_x&v_x&w_x\\u_y&v_y&w_y\\u_z&v_z&w_z\end{pmatrix}$$

Now any vector $a=\begin{pmatrix}a_x\\a_y\\a_z\end{pmatrix}$ is transformed from the local coordinates to the world coordinates with vectors $\mathcal{i}=\begin{pmatrix}1\\0\\0\end{pmatrix}$, $\mathcal{j}=\begin{pmatrix}0\\1\\0\end{pmatrix}$ and $\mathcal{k}=\begin{pmatrix}0\\0\\1\end{pmatrix}$ by simple matrix multiplication

$a_{world}=Ra=\begin{pmatrix}u_xa_x+v_xa_y+w_xa_z\\u_ya_x+v_ya_y+w_ya_z\\u_za_x+v_za_y+w_za_z\end{pmatrix}$

thats it.

-
translation should also be included –  INS Feb 18 '13 at 11:10
The OP never mentioned translations. –  ja72 Feb 18 '13 at 14:26