Vector 20 Fractals
You’ve probably heard of fractals: mathematical sets with a self-similar structure. Each smaller part is a miniature copy of the whole structure. Today, we will see how to use linear transformations and homogeneous coordiantes to generate a fractal.
We will generate a fractal by repeatedly applying the following 3D linear transformations.
We pick one of these four transformations using some randomness. Most of the time we apply matrix A1. Occasionally, we apply matrix A2 or A3. And rarely we apply A4.
So let’s generate a fractal!
20.1 Transforming My House.
So what is happening? Let’s look at the effect of each of these linear transformations on my house
## [,1] [,2] [,3]
## [1,] 0.20 -0.25 0.0
## [2,] 0.21 0.23 1.5
## [3,] 0.00 0.00 1.0
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,] 0.00 0.046875 0.066875 0.02000 0.0400 0.1025 0.112500
## [2,] 2.25 2.289675 2.311725 2.27205 2.2941 2.3470 2.358025
## [3,] 1.00 1.000000 1.000000 1.00000 1.0000 1.0000 1.000000
## [,8] [,9] [,10] [,11] [,12]
## [1,] 0.1250 0.012500 0.0225 -0.0400 0.00
## [2,] 2.3558 2.247775 2.2588 2.2059 2.25
## [3,] 1.0000 1.000000 1.0000 1.0000 1.00
20.2 Watching a series of points.
Let’s see what happens when we repeatedly apply the same mapping.
## Your Turn
Make some small adjustments to one of these matrices. Explore the impact of the fractal. Can you make it spikier? Bushier?
20.3 Here are some from http://paulbourke.net/fractals/ifs/
a 0.2020 0.1380
b -0.8050 0.6650
c -0.6890 -0.5020
d -0.3420 -0.2220
e -0.3730 0.6600
f -0.6530 -0.2770
## [,1] [,2]
## [1,] 0.824074 0.088272
## [2,] 0.281428 0.520988
## [3,] -0.212346 -0.463889
## [4,] 0.864198 -0.377778
## [5,] -1.882290 0.785360
## [6,] -0.110607 8.095795
## [[1]]
## [,1] [,2] [,3]
## [1,] 0.787879 -0.424242 1.758647
## [2,] 0.242424 0.859848 1.408065
## [3,] 0.000000 0.000000 1.000000
##
## [[2]]
## [,1] [,2] [,3]
## [1,] -0.121212 0.257576 -6.721654
## [2,] 0.151515 0.053030 1.377236
## [3,] 0.000000 0.000000 1.000000
##
## [[3]]
## [,1] [,2] [,3]
## [1,] 0.181818 -0.136364 6.086107
## [2,] 0.090909 0.181818 1.568035
## [3,] 0.000000 0.000000 1.000000