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.
: 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.