Interactive Transformation Matricies
Geometric transformations in computer graphics can be represented as
4x4 transformation matricies. This page illustrates how the
translation, scale, and rotation transformations are represented as
matricies and how they can be combined to build up more complex
transformations. This page is best viewed on a colour monitor.
See the
lecture notes on Geometric Transformations.
The interactive applet below illustrates the effect of any
transformation primitive typed into the text bar. Transformation
primitives are just a short form for the 4x4 transformation
matrix. The syntax is as follows:
Instructions
- A default transformation is provided to illustrate the 3D nature of the
cube.
- Modify the default transforamtion or type a new transformation in the text field below. For example:
trans(0.5, -1, 0).
- Once you type a carriage return after the closing
parenthesis the transformation will be shown in the matrix display
and on the axis. If there is a syntax error the identity matrix will be
assumed.
- At this point you can either modify the values of the existing
transformation or continue typing another transformation.
- If another transformation is added then the second is post
multiplied to the first and the result is displayed.
- The scrollbar zooms in and out, usefull if your transformation makes
the figure go off of the screen.
- Drag the mouse while holding down a button to shift the axes.
Notes
- Each tick mark measures 1 unit in world coordinates. A unit cube is
shown.
- Angles are measured in degrees.
- Decimal values can be used in the trans and scale primitives (ie
scale(-1,0.3,1) or trans(0.5,0.5,0.5) ). Integers
only for the rotation primitives.
- Scaling in the negative Z axis causes the cube ends to be painted
incorrectly. This is because the coloured ends of the cube are drawn according to the direction of their
normal. In this way the end that is facing away from the viewer can be drawn first.
The cube is initially defined so that the normals are pointing out of the cube.
However it is possible to deform the cube using transformations so that
the normals point into the cube. When this occurs the cube will be drawn incorrectly.
- If nothing happens (or you get the identity matrix)
when you type in a transformation check that
there are both opening and closing parenthesis and that the
primitive names are spelled correctly.
- The axis shown are to provide scale and relative position cues,
for the X-Y axis only. Even if the cube is translated -100 units into
the Z direction (into the page), the cube will still appear in front of
the axis.
TRY THIS!
- This is a right-handed coordinate system. If you translated the cube
-2 units in the Z direction and then rotated the cube about the X-axis by
45 degrees, which direction would you expect the cube to move on the screen?
- Try increasing the angle measures to see how the cube "moves" in
three space. Use occlusion (which end appears in front of the other) to
resolve the cube's orientation.
(Applet by Eric Kelley
, please send bug reports, questions, comments,
or tickets to somewhere warm to kelley@dgp.utoronto.ca)
Java source code