Projections & Transformations

1. Polygons

The lowest level of 2D graphics operates directly on the pixels in the image (e.g. SetPixel, DrawLine, etc.). To make it device independent, we have window size independent world coordinates. These will be normalised to device coordinates (e.g. [0, width] x [0, height]):

3D objects are rendered with planar polygons. To store this, we need to store 3D coordinates (numerical data) and topological data. This corresponds to the vertex and face data structures. A mesh is a collection of polygons.

2. Projections

To draw a wireframe model, we need to project the 3D coordinates onto a 2D plane. There are two main types of projections:

3. Transformations

We want to draw a graphics scene from any angle, so its a lot easier to have the viewpoint at the origin and the -axis as the direction of view. To allow matrix multiplication to model all transformations (including translations), we need to use 4D homogeneous coordinates, i.e. . Usually we set .

Affine Transformations are those that preserve parallel lines. Most transformations are affine, including scaling, rotation & transformation. Non-affine transformations include perspective projections.

The order of transformations is significant, i.e. transformations are not commutative.

3.1 Translation

To apply a translation we can do:

Since we know what a translation matrix does, we can write down its inversion directly:

3.2 Scaling

To apply a scaling we can do:

The inverse scaling matrix is:

3.3 Rotation

To define a rotation we need an axis and an angle. The simplest rotations are about the Cartesian axis, i.e. is about the -axis, about the -axis and about the -axis.

The rotation matrices are:

Rotations have direction, i.e. rotation is anti-clockwise when looking along the axis of rotation. Rotation is clockwise when looking back towards the origin from the positive axis direction.

To find the inverse we rotate by angle .

Back to Home