Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fractals and L-Systems

Similar presentations


Presentation on theme: "Fractals and L-Systems"— Presentation transcript:

1 Fractals and L-Systems
Brian Cavalier 15-462 November 25, 1997 1

2 Overview The notion of a fractal Self similarity and Iteration
Fractal Dimension Fractal Uses L-Systems 2

3 What’s With Euclid Anyway? (Motivation)
Aren’t sphere’s, cubes, and polygons good enough? Well, it depends on your intent, but ... Not many interesting real-world objects are really traditional geometric objects. Coastlines, trees, lightning These could be modeled with cylinders, polygons, etc, but ... Their true level of complexity can only be crudely approximated with traditional geometric shapes 3

4 First, a Question How long is the coast line of Britain?
How would you measure it? 4

5 A Solution? Start by looking at it from a satellite Well, sort of ...
Pick equally spaced points and draw lines between them. Then measure the lines Now you know the length, right? Well, sort of ... What if you move closer and decrease the distance between the points? Suddenly what looked like a straight stretch of coast becomes bays and peninsulas 5

6 The Notion of a Fractal “... a geometrically complex object, the complexity of which arises through the repetition of form over some range of scales.” -- Ken Musgrave, Texturing and Modeling Say what? 6

7 Self-Similarity and Iteration
Simple Shapes repeat themselves exactly at different scales Koch curves and snowflakes Statistical Statistics of a random geometry are similar at different scales Trees, rivers, mountains, lightning 7

8 Physical Dimension A point, line, plane, and cube all have physical dimension that we accept as being 0, 1, 2, and 3 respectively. Mandelbrot’s view Dimension is a scale-dependent term Consider zooming in on a ball of thread 10

9 Fractal Dimension In the Euclidian plane
we usually speak of topological dimension, which is always an integer. Fractal dimensions can have non-integer values. What does a dimension of, say, 2.3 mean? 2 is the underlying Euclidian dimension of the fractal The fractional value “slides” from 0 to as the fractal goes from occupying its Euclidian dimension, e.g. plane, to densely filling some part of the next higher dimension. 11

10 Simple Fractals Using Iteration
Use mathematical iteration and simple logic to produce amazing images One kind, you have already seen in the Koch and Sierpinski fractals Another kind is more numerical Mandelbrot Julia fractional Brownian motion 12

11 Mandelbrot Set - How? Simple algorithm using points on the complex plane Pick a point on the complex plane The corresponding complex number has the form: x + i*y, where i = sqrt( - 1 ) Iterate on the function Zn = Zn C Where Z0 = 0, and Z1 = C2 + C What does Z do? It either Remains near the origin, or Eventually goes toward infinity 14

12 Mandelbrot Set - How? (2) To produce pretty pictures, do this for every point C on the complex plane where -2.5 < x < 1.5, and -1.5 < y < 1.5 See how many iterations it takes for Z to go to infinity Uh, how do you compute that? Just pick some max number of iterations to check It turns out if the distance ever grows to a value > 2, the iteration will go to infinity. Color the point C based on the number of iterations 15

13 Julia Sets Just a variant on Mandelbrot Sets
There is an entire Julia Set corresponding to each point in the complex plane. An infinite number of Julia Sets Most interesting sets tend to be those found by using points just outside the Mandlebrot set. Similar Iteration formula, but vary Z not C Zn = Zn-12 + C These sets were named for mathematician Gaston Julia, and can be generated by a simple change in the iteration process described for the Mandelbrot Set (p. 29). Start with a specified value of C, "C-real + i * C-imaginary"; use as the initial value of Z "x-coordinate + i * y- coordinate"; and repeat the same iteration, Z(n+1) = Z(n)^2 + C. There is a Julia set corresponding to every point on the complex plane -- an infinite number of Julia sets. But the most visually interesting tend to be found for the same C values where the M-set image is busiest, i.e. points just outside the boundary. Go too far inside, and the corresponding Julia set is a circle; go too far outside, and it breaks up into scattered points. In fact, all Julia sets for C within the M-set share the "connected" property of the M-set, and all those for C outside lack it. Fractint's spacebar toggle lets you "flip" between any view of the M-set and the Julia set for the point C at the center of that screen. You can then toggle back, or zoom your way into the Julia set for a while and then return to the M-set. So if the infinite complexity of the M-set palls, remember: each of its infinite points opens up a whole new Julia set. Historically, the Julia sets came first: it was while looking at the M- set as an "index" of all the Julia sets' origins that Mandelbrot noticed its properties. The relationship between the Mandelbrot set and Julia set can hold between other sets as well. Many of Fractint's types are "Mandelbrot/Julia" pairs (sometimes called "M-sets" or "J-sets". All these are generated by equations that are of the form z(k+1) = f(z(k),c), where the function orbit is the sequence z(0), z(1), ..., and the variable c is a complex parameter of the equation. The value c is fixed for "Julia" sets and is equal to the first two parameters entered with the "params=Creal/Cimag" command. The initial orbit value z(0) is the complex number corresponding to the screen pixel. For Mandelbrot sets, the parameter c is the complex number corresponding to the screen pixel. The value z(0) is c plus a perturbation equal to the values of the first two parameters. See the discussion of Mandellambda Sets (p. 35). 16

14 Fractional Brownian Motion
double fBm( Vector point, double H, double lacunarity, double octaves ) { if ( firstTimeCalled ) { initialize exponent table for octaves } for( i=0 to octaves-1 ) { value = BasisFuction( point )*exponentForOctave( i ); point.x *= lacunarity; point.y *= lacunarity; point.z *= lacunarity; if( octaves not and integer ) { value += fractionalPartOf( octaves ) * BasisFunction( point )*exponentForOctave( i ); return value; point - the point in space to compute the value for value - the value for point H - the fractal increment?? lacunarity - The amount by which we change the lateral size, or frequency, in each step of the iterative addition process. A fancy word for “gap” octaves - how far we have scaled “into” the fractal to add values Set up exponent tables: Precompute multipliers for each octave by calculating pow( frequecy, -H ) for each octave - remember frequency *= lacunarity after each iteration 17

15 Cool, But What are They Good For?
Not just neat pictures in 2D Procedural Textures Terrain Generation Other Realism Music?!? 18

16 L-Systems Remember the Koch Curve & Snowflake?
Think of it as a grammar: 24

17 Just Add Water ... L-Systems “grow” based on their production rules
Plants Cells Can control the iteration of production rules and actually animate the growth Grammars of fine enough granularity could simulate growth at the cell level ... talk about eating CPU cycles ... Now show other grammars and the images of L-Systems 26


Download ppt "Fractals and L-Systems"

Similar presentations


Ads by Google