_ _ _ _ _ _ _ _
| x' | | a b | | x | | e |
| y' | = | c d | | y | + | f |
- - - - - - - -
where (x', y') is the image of the point (x, y).
The above matrix formula can also be written as two individual equations:
x' = ax + by + e
y' = cx + dy + f
So it takes 6 numbers to describe each of the transformations in the iterated
function system. If you're given the transformations, you now know enough to
create the final images (the fractals). However, if you want to define
the linear transformations yourself, you need to understand the 6 constants
a little better.
First let's examine the constants a, b, c and d. The easiest way to view these is to imagine how these constants affect the rectangle with the segment from (0, 0) to (1, 0) and (0, 0) to (0, 1) as two of its sides. The bottom horizontal segment of this square (the vector (1,0)) gets mapped to the segment from (0, 0) to (a, c) (the vector (a,c)). The left vertical segment of this square (the vector (0, 1) gets mapped to the segment from (0, 0) to (b, d). This creates a parallelogram with one corner at the origin. The square is transformed to that parallelogram, and so the transformation may involve rotations, shearing, scaling, or mirror images. The last possibility is a translation, which is handled by the constants e and f. The parallelogram is translated to the right and upwards by the constants e and f (respectively). What we've seen is that to describe an affine transformation with the 6 numbers a, b, c, d, e, and f, we need to figure out where we want the lower horizontal and left vertical sides of the square to land to form a parallogram (giving us the constants a, b, c and d), and then we need to decide how to translate this paralellogram (giving us the constants e and f).
Here are some examples:
1. The image is rotated 90 degrees clockwise in place. This is
the same as a 90 degree clockwise rotation around the origin, followed by
a shift one unit up. (Since the parallelogram defined by
the constants a, b, c and d must have the original lower left corner
stay at the origin,
those 4 constants can only describe a rotation around the origin).
So the lower horizontal side moves to the vector (0, -1), and the
left vertical side moves to the vector (1, 0). We now take this
parallelogram and shift it up by 1 unit, or add the vector
(0, 1). This gives us the final transformation:
_ _ _ _ _ _ _ _
| x' | | 0 1 | | x | | 0 |
| y' | = | -1 0 | | y | + | 1 |
- - - - - - - -
In general, a clockwise rotation of θ degrees about the origin
is represented by the matrix
_ _
| cos θ sin θ |
| -sin θ cos θ |
- -
2. Reflect the image vertically, in place. This is the same as
a reflection over the y-axis, followed by a translation to the right
by 1 unit. The lower horizontal edge transforms to the vector (-1, 0)
and the vertical left edge stays put at the vector (0, 1). The translation
means adding the vector (1, 0). Here's the transformation:
_ _ _ _ _ _ _ _
| x' | | 0 -1 | | x | | 1 |
| y' | = | 1 0 | | y | + | 0 |
- - - - - - - -
3. Scale down by a factor of 2 in each direction, and place the image
in upper right quadrant. The vector (1, 0) maps to (.5, 0) and
(0, 1) maps to (0, .5). Then, the image is shifted by (.5, .5)
_ _ _ _ _ _ _ _
| x' | | .5 0 | | x | | .5 |
| y' | = | 0 .5 | | y | + | .5 |
- - - - - - - -
This is the 2nd transformation in the leaning Sierpinski gasket IFS.