banner.gif
On-Line Computer Graphics Notes
HOW TRANSFORMATIONS WORK


Overview

We have shown that given two frames in an affine space of dimension $ n$, we can find a $ (n+1) \times (n+1)$ matrix that converts the coordinates of a point in the first frame to the coordinates of the same point in the second frame. These operations are called transformations and they can be looked at in either of two ways : they convert the local coordinates between two frames, or alternatively, leave the coordinates constant and change the frames themselves.

We will restrict ourselves to 3-dimensional space in this discussion. In this space a frame consists of three linearly independent vectors (usually denoted $ {\vec u} $, $ {\vec v} $ and $ {\vec w} $), and a point $ {\bf O} $ representing the origin of the frame. The coordinates are written as $ (u,v,w)$, meaning a point $ {\bf P} $ has a unique representation

$\displaystyle {\bf P} = u {\vec u} + v {\vec v} + w {\vec w} + {\bf O}
$

where $ (u,v,w)$ are now the coordinates of the point.

pdficonsmall.gif For a pdf version of these notes look here.


The Local Coordinates of a Point with Respect to a Frame

We have shown in the notes on frames that, given two frames, $ {\cal F} _1 = ( {\vec u} _1, {\vec v} _1, {\vec w} _1, {\bf O} _1)$ and $ {\cal F} _2 = ( {\vec u} _2, {\vec v} _2, {\vec w} _2, {\bf O} _2)$, we can relate the coordinates of the two frames by an $ 4 \times 4$ matrix

$\displaystyle \left[
\begin{array}{cccc}
e_{1,1} & e_{1,2} & e_{1,3} & 0 \\
e...
... e_{3,2} & e_{3,3} & 0 \\
e_{4,1} & e_{4,2} & e_{4,3} & 1
\end{array}\right]
$

where the coefficients $ e_{i,j}$ are obtained by writing the vectors and origin of the initial frame $ {\cal F} _1 = ( {\vec u} _1, {\vec v} _1, {\vec w} _1, {\bf O} _1)$ in terms of the vectors and origin of the final frame $ {\cal F} _2 = ( {\vec u} _2, {\vec v} _2, {\vec w} _2, {\bf O} _2)$.

If $ {\bf P} $ is a point which has local coordinates $ (u_1, v_1, w_1)$ with respect to the frame $ {\cal F} _1$, then we can calculate the local coordinates $ (u_2, v_2, w_2)$ of $ {\bf P} $ with respect to the frame $ {\cal F} _2$ by

$\displaystyle \left[
\begin{array}{cccc}
u_2 & v_2 & w_2 & 1
\end{array}\right]...
... e_{3,2} & e_{3,3} & 0 \\
e_{4,1} & e_{4,2} & e_{4,3} & 1
\end{array}\right]
$

and our point $ {\bf P} $ can be written as

$\displaystyle {\bf P} \: = \:
\left[
\begin{array}{cccc}
u_1 & v_1 & w_1 & 1
\...
...vec u} _2 \\
{\vec v} _2 \\
{\vec w} _2 \\
{\bf O} _2
\end{array}\right]
$

This equation motivates the study of the equations

$\displaystyle {\bf P} \: = \:
\left[
\begin{array}{cccc}
u & v & w & 1
\end{ar...
...rray}{c}
{\vec u} \\
{\vec v} \\
{\vec w} \\
{\bf O}
\end{array}\right]
$

where the $ 4 \times 4$ matrix represents a transformation. This transformation can be applied in two ways in this equation - applied to the coordinate on its left by multiplying the matrix on the right,

   Coordinate$\displaystyle \:\:\:
\left[
\begin{array}{cccc}
u & v & w & 1
\end{array}\right...
...s 4 & \; \\
\; & matrix & \; \\
\; & \; & \; \\
\end{array}\right]
\:\:\:$   with frame$\displaystyle \:\:\:
\left[
\begin{array}{c}
{\vec u} \\
{\vec v} \\
{\vec w} \\
{\bf O}
\end{array}\right]
$

or applied to the frame on its right by multiplying the matrix on the left.

   Coordinate$\displaystyle \:\:\:
\left[
\begin{array}{cccc}
u & v & w & 1
\end{array}\right]
\:\:\:$   with frame$\displaystyle \:\:\:
\left[
\begin{array}{ccc}
\; & \; & \; \\
\; & 4 \times ...
...rray}{c}
{\vec u} \\
{\vec v} \\
{\vec w} \\
{\bf O}
\end{array}\right]
$


Transforming the Local Coordinates within a Frame

If we apply the $ 4 \times 4$ matrix in the above equation to the coordinate, $ \left[
\begin{array}{cccc}
u & v & w & 1
\end{array}\right]
$ it can be viewed as a method of transforming coordinates within a frame. If we select an appropriate $ 4 \times 4$ matrix, we can utilize it to perform the same operation on all coordinates of the frame.

For example, consider the matrix

$\displaystyle \left[
\begin{array}{cccc}
2 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 1 & 1
\end{array}\right]
$

If we apply this matrix to the coordinate $ \left[
\begin{array}{cccc}
u & v & w & 1
\end{array}\right]
$ we have

$\displaystyle \left[
\begin{array}{cccc}
u & v & w & 1
\end{array}\right]
\left...
...\right]
\: = \:
\left[
\begin{array}{cccc}
2u & v & w+1 & 1
\end{array}\right]
$

In other words, this matrix causes the $ u$ coordinate to be doubled and $ w$ coordinate incremented by one - and the operation can be applied to the local coordinates of any frame. So, by studying different $ 4 \times 4$ matrices, we can develop methods by which we can move coordinates about within a frame.


Transforming the Frame

If we apply the $ 4 \times 4$ matrix in the above equation to the frame,

$\displaystyle \left[
\begin{array}{c}
{\vec u} \\
{\vec v} \\
{\vec w} \\
{\bf O}
\end{array}\right]
$

it can be viewed as transforming the frame. In particular, if we consider again the matrix

$\displaystyle \left[
\begin{array}{cccc}
2 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 1 & 1
\end{array}\right]
$

multiplying the frame by the matrix gives

$\displaystyle \left[
\begin{array}{cccc}
2 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
...
...vec u} \\
{\vec v} \\
{\vec w} \\
{\vec w} + {\bf O}
\end{array}\right]
$

resulting the the doubling of the length of the first vector of the frame, and the shifting of the origin of the frame by $ {\vec w} $ - and the operation can be applied to any frame. So, by studying different $ 4 \times 4$ matrices, we can develop methods by which we can transform frames.


We Get the Same Result

Both transforming the local coordinates and transforming the frame come from the basic equation.

$\displaystyle {\bf P} \: = \:
\left[
\begin{array}{cccc}
u & v & w & 1
\end{ar...
...rray}{c}
{\vec u} \\
{\vec v} \\
{\vec w} \\
{\bf O}
\end{array}\right]
$

and the matrix can be applied either to the coordinate (by multiplying on the right), leaving the frame fixed, or to the frame (by multiplication on the left), leaving the coordinate fixed. In either case, we get the same point $ {\bf P} $. This enables us to look at the matrix as either moving the frame, or transforming the coordinate - which is frequently useful when discussing the effects of the transformation.


Summary

In the study of transformations it is useful to allow us to shift our point of view between the local coordinates of a point, or the frame that defines the local coordinate system. In this case, we can concentrate on either, as the transformations apply to both frames and coordinates.

There is one basic mathematical difference between the two points of view - applying transformations to local coordinates implies that the matrix is multiplied on the right, where applying transformations to frames implies that the matrix is multiplied on the left.


Return to the Graphics Notes Home Page
Return to the Geometric Modeling Notes Home Page
Return to the UC Davis Visualization and Graphics Group Home Page


This document maintained by Ken Joy

Mail us your comments

All contents copyright (c) 1996, 1997, 1998, 1999
Computer Science Department
University of California, Davis

All rights reserved.


Ken Joy
1999-12-06