Tuesday, April 2, 2013

Affine Contraction Mappings

I took full advantage of my spring break by spending the day writing a program that allows the creation of geometric affine maps.  You can then pass a set of points through the map instructions and your output will be a deterministic fractal.

A geometric affine map can be written in this way:

map = Affine(r,s,theta,phi,e,f) where,
i. r,s are scale factors between 0 - 1 for the x & y-axis
ii. theta, phi are rotations along the x & y-axis
iii. e,f are transformations along the x & y-axis

Here's my first example and test to see that the program works.  I defined the famous Sierpinski affine mappings.

map1 = Affine(.5,.5,0,0,0,.5)
map2 = Affine(.5,.5,0,0,.5,0)
map3 = Affine(.5,.5,0,0,0,0)

Let your starting set of points be only (0,0) and iterate this 8 times and you will end up with 3^8 points (6561), plot those points and you will see the following image.

Here's another set of affine maps that are related to the Sierpinski triangle except for one rotational value in just one of the three maps.  This highlights the significance and sensitivity one minor variable change can have on an outcome.

map1 = Affine(.5,.5,-180,0,0,.5)
map2 = Affine(.5,.5,0,0,.5,0)
map3 = Affine(.5,.5,0,0,0,0)

No comments:

Post a Comment