# Linear Transformations and Basic Computer Graphics

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Choose up to three different actions with the "add transformation" buttons. This shows the ordered list of transformations and the corresponding image of the composite linear transformation. From there you can modify the values of the parameters with the sliders, or you can clear all or one of the actions with one of the "remove transformation"* *buttons.

Contributed by: Ana Moura Santos and João Pedro Pargana (March 2011)

(Instituto Superior Técnico)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

With the help of this Demonstration, we want to illustrate the basics of computer graphics. Within this context, the graphical objects are described by collections of straight line segments, since linear transformations map line segments onto line segments. We look at the new positions of the principal vertices of the transformed object, and connect them by straight lines in order to obtain the final image of the original object.

The mathematics of computer graphics is closely related to matrix multiplication. If you are not very familiar with the idea, this is the time to try to understand how to describe the basic transformations with matrices. Look carefully at the form of each standard 2×2 matrix that describes the given transformation. For the transformation that rotates each point about the origin through an angle , the entries are cosines and sines of the angle . The standard matrix for the counterclockwise rotation with positive has the form . Reflections through lines are described by invertible (nonsingular) matrices with entries from the set . Orthogonal projections of points onto lines are described by non-invertible matrices with entries from the set . Scaling with a given factor can be achieved by putting in the diagonal entries and zero elsewhere, that is, scaling is described by a scalar multiple of the identity matrix. For the matrix describes an overall contraction of the object, and for an overall expansion. The standard matrix that describes a horizontal shear is of the form and the standard matrix that describes a vertical shear is of the form . Notice that translating an object is not an option. Indeed, this action cannot be described as a multiplication by a 2×2 matrix, that is, translation is not a linear transformation. In order to translate objects using matrices we must use homogeneous coordinates.

The standard matrix that describes a composite linear transformation can be represented as a multiplication of the standard matrices described above.

Very important: note the order of multiplication! This can be seen, for instance, in the case of a composition of three different transformations: the first transformation to be applied to the object is the rightmost factor in the multiplication, the second transformation is the middle factor, and the third and last action is the leftmost factor.

## Permanent Citation