Direct computation:
for each (x0, y0) {
getPixel(x0, y0, color);
(x, y) = F(x0, y0);
setPixel(x, y, color);
}
Drawback: although transformations are continuous functions in the real plane, when applied to a discrete area of pixels, they may create gaps in the transformed area because of the scan conversion.
General method: apply the inverse transformation.
determine the boundary of the transformed area by a direct transformation;
for each (x, y) {
(x0, y0) = F-1(x, y);
getPixel(x0, y0, color);
setPixel(x, y, color);
}
By this method, we leave no pixel out of the transformed area.

| Direct transformation |
(
|
y |
|
yo |
) + ( |
|
) |
| Inverse transformation |
(
|
yo |
|
y |
) - ( |
|
) |
Rotation matrix:
|
|
|
sin a |
- sin a
cos a |
) |

| Direct transformation |
(
|
y |
|
Ra * ( |
|
) |
| Inverse transformation |
(
|
yo |
|
R -a * ( |
y |
) |
|
(
|
yo |
|
sin (-a) |
- sin (-a)
cos (-a) |
) * ( |
|
) |
|
(
|
yo |
|
- sin a |
sin a
cos a |
) * ( |
|
) |
| Direct transformation |
(
|
y |
|
a 0 0 b | ) * ( |
yo |
) |
| Inverse transformation |
(
|
yo |
|
1/a 0 0 1/b | ) * ( |
y |
) |
|
Flip vertically (axis = Ox)
|
( |
yo |
|
1 0 0 -1 | ) * ( |
y |
) |
|
Flip horizontally (axis = Oy)
|
( |
yo |
|
-1 0 0 1 | ) * ( |
y |
) |
From the programmer's point of view: recursively defined drawings.
Mandelbrot set:
|
|
The Sierpinski triangle |
![]() |
![]() |
| The Mandelbrot Set | The Julia Set |
![]() |
![]() |