| 21 | |
| 22 | To rotate in the clockwise direction: |
| 23 | |
| 24 | [[Image(CW_rotation.png)]] |
| 25 | |
| 26 | * x' = xcosθ + ysinθ |
| 27 | * y' = − xsinθ + ycosθ |
| 28 | |
| 29 | === Scaling === |
| 30 | |
| 31 | Scaling is used to set the size of the raster's grid cells in the x and y direction. The transformation is as follows: |
| 32 | |
| 33 | [[Image(scaling.png)]] |
| 34 | |
| 35 | * x' = x s,,x,, |
| 36 | * y' = y s,,y,, |
| 37 | |
| 38 | === Shearing === |
| 39 | |
| 40 | Shearing is visually equivalent to a "slanting" which is parallel to either the x or the y axis. This is a less common operation than rotation and scaling. These are presented as individual operations: one for each axis. |
| 41 | |
| 42 | Shearing parallel to the x axis takes the following form. |
| 43 | |
| 44 | [[Image(shear_x.png)]] |
| 45 | |
| 46 | * x' = x + k,,x,,y |
| 47 | * y' = y |
| 48 | |
| 49 | While shearing parallel to the y axis has this form: |
| 50 | |
| 51 | [[Image(shear_y.png)]] |
| 52 | |
| 53 | * x' = x |
| 54 | * y' = k,,y,,x + y |
| 55 | |
| 56 | == Combining individual operations == |
| 57 | |
| 58 | Whenever more than one of the above operations is required, they may be combined using [http://en.wikipedia.org/wiki/Matrix_multiplication matrix multiplication]. As an example, all of the above matrices will be combined into one. The result of such a combination is still not an affine transform, however. It is just a 2x2 matrix has all the individual functions aggregated into it. |