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}$.
transformation of 3D coordinate system
-
0Your question literally asks how to transform a cylinder into a coordinate system. :-\. – 2012-02-09
2 Answers
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.
-
0The OP never mentioned translations. – 2013-02-18
You didn't say how you are representing a cylinder numerically.
But, in general, to coordinate rotate an object (recompute it for rotated axes), each numerical feature used to represent the object is put through the specified coordinate rotation (except the scalar features which are invariant under coord rotation. Example:
Let's say you represent a generalized cylindrical segment. One approach is to model it as an inflated line segment:
CylindricalSegment:
entPt1 - any 3D point [ x y z ]
endPt2 - any different 3D point [ x y z ]
radius - cylindrical radius (positive scalar)
To coordinate rotate a cylinder, the end points are pushed through the rotational transform. The radius is untouched by axes rotation, so:
coordinate_rotate (cylindricalSegment CS ) =
new CylindricalSegment ( coordinateRotate( endPt1 ) coordinateRotate( endPt2 ) radius )