## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Transformation Matrices

A transformation matrix maps points from one coordinate space into another coordinate space. Cocoa and Quartz use transformation matrices to perform standard graphical display operations such as scaling, rotation, and translation.

The matrix used to accomplish two-dimensional transformations is described by a 3 × 3 matrix. Figure 1.3 shows a sample 3 × 3 matrix. Note that `u` and `v` are always 0.0, and `w` is always 1.

The contents of a 3 × 3 matrix transform a pointx,y into a point x’,y’ by means of the following equations:

For example, the matrix shown in Figure 1.4 performs no translation. It is referred to as the identity matrix.

Using the formulas discussed earlier, you can see that this matrix would generate a new point x’,y’ that is the same as the old point x,y:

To move an image by a specified displacement, you can perform a translation operation. This operation modifies the x and y coordinates of each point by a specified amount. The matrix shown in Figure 1.5 describes a translation ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required