MAPaint Technical Report:
Coordinate Transformation

next up previous contents
Next: Viewing Planes Up: Geometry Previous: Geometry

Coordinate Transformation

There are many ways to define an arbitrary rotation, scaling and translation of one coordinate frame into another. For the purposes of the paint program we define a set of parameters for viewing arbitrary planes through reconstructions which seem to be the most useful in terms of the way in which the paint program will be used and which should be easy to visualise for the user. The relationship between these transforms and the general affine transform used elsewhere is most easily found be direct comparison of the transform matrix elements.

We define a viewing plane by defining a new set of coordinate axes such that the new z-axis is along the ``line-of-sight''. This axis is fully determined by defining a single fixed point which is the new coordinate origin. The actual view plane is then defined to be perpendicular to this axis and is determined by a scalar distance parameter along the new axis. In this way the transformation between the original, ${\bf r} = (x,y,z)$, and viewing coordinates, ${\bf r'} = (x',y',z')$, is determined by a 3D rotation and translation with the viewing plane defined as a plane of constant z' = d. These parameters are dipicted in figure 3.


  
Figure: The viewing plane is defined to be perpendicular to the viewing direction given by angles $\theta $ and $\phi$ which are yaw and pitch respectively. The actual plane is distance d from the fixed point f.
\begin{figure}
\addtolength{\textwidth}{-1cm}
\centerline{\epsfysize=10cm \ep...
...centerline{\parbox{\textwidth}{
}}
\addtolength{\textwidth}{1cm}
\end{figure}

A 3D rotation can be defined in terms of Eulerian angles[3, page 107] which are not consistently defined in the literature, but for which we assume the usual British definition[9, page 9], where a rotation about an axis is clockwise in the direction of the axis and the second rotation is about the new y-axis:

1.
rotate by angle $\xi$ (xsi) about the z-axis
2.
rotate by angle $\eta$ (eta) about the new y-axis,
3.
rotate by angle $\zeta$ (zeta) about the new z-axis.
This sequence is depicted in figure 4.

The rotation matrix defined by these angle is most easily determined as a product of three rotations:

\begin{displaymath}R = R_{\zeta} R_{\eta} R_{\xi}
\end{displaymath} (1)

where in matrix notation
$\displaystyle R_{\xi}$ = $\displaystyle \left( \begin{array}{ccc}
cos(\xi) & sin(\xi) & 0 \\
-sin(\xi) & cos(\xi) & 0 \\
0 & 0 & 1
\end{array} \right),$ (2)
$\displaystyle R_{\eta}$ = $\displaystyle \left( \begin{array}{ccc}
cos(\eta) & 0 & -sin(\eta) \\
0 & 1 & 0 \\
sin(\eta) & 0 & cos(\eta)
\end{array} \right) \;\mbox{and}$ (3)
$\displaystyle R_{\zeta}$ = $\displaystyle \left( \begin{array}{ccc}
cos(\zeta) & sin(\zeta) & 0 \\
-sin(\zeta) & cos(\zeta) & 0 \\
0 & 0 & 1
\end{array} \right).$ (4)


  
Figure: The Eulerian angles. The line of intersection between the original x-y plane and the new x'-y' plane is known as the ``line of nodes'' and shown extended in red in the figure. The x' axis is below the original plane and not shown.
\begin{figure}
\addtolength{\textwidth}{-1cm}
\centerline{\epsfysize=10cm \ep...
...centerline{\parbox{\textwidth}{
}}
\addtolength{\textwidth}{1cm}
\end{figure}

Multiplying the individual matrices yields

   \begin{displaymath}
R = \left( \begin{array}{ccc}
cos(\zeta)cos(\eta)cos(\xi) - ...
...a)cos(\xi) & sin(\eta)sin(\xi) & cos(\eta)
\end{array} \right)
\end{displaymath}

A rigid body transformation can be described as a rotation followed by a translation. In our case we may wish to display the section with magnification and therefore the transformation from screen to object coordinates will also involve scaling. With this in mind we define the transform from object to viewing coordinates as

 \begin{displaymath}
{\bf r'} = s R ({\bf r} - {\bf f}),
\end{displaymath} (5)

where s is the scaling and ${\bf f}$ is the fixed point in the original coordinates. Most of the calculations we require involve the inverse transform

 \begin{displaymath}
{\bf r} = \frac{1}{s} R^{-1} {\bf r'} + {\bf f},
\end{displaymath} (6)

where R-1 = RT (transposed matrix)[3].


next up previous contents
Next: Viewing Planes Up: Geometry Previous: Geometry

Richard Baldock
1998-06-05