advertisement

advertisement

Information about Evolutionary Graphics - Class 03 2014

advertisement

Thinking Recursively

Money example If you want to collect $1,000 from your BU classmates, and each of the student can only afford to give you $10, how would you do?

Method 1 The first method is a traditional thinking mode. You can approach every student you meet and ask him/her to donate $10.

Iterative approach We call this – iterative approach. It is similar to a loop in computer programming. You continue to ask students for $10 until you reach the target of $1,000.

Iterative approach while (money collected < $1,000) { meet next student; ask for $10 donation; if (ok) add to the money collected; }

Other approach The iterative approach is straight forward and effective. We can ask if there are any better approaches to this problem.

Recursive approach It is not very efficient if I need to ask 100 students to collect the $1,000. Consider the case: I just ask 10 students to collect money for me. Each of them has to collect $100 by whatever means.

Recursive approach Then the 10 students will concurrently go out to ask 10 or more students to collect $10 each from them.

Recursive approach $1000 $100 $100 $10 $10 ... $100 $10 $100 ... $10

Divide and conquer Divide and conquer 1. Decompose the original problem into simpler instances of the same problem. 2. The simpler problems must become so simple that they can be solved without further division. 3. Combine the smaller solutions to produce a solution to the original problem.

Piet Mondrian

Blank canvas

Problem statement We want to divide a rectangle into a square and a smaller rectangle. Continue to divide the smaller rectangle until it is too small to be visible on screen.

First division

The process Note that, the second division will be the same as the first one, except the rectangle rotates by 90 degrees counter-clockwise.

Second division

Third division

Forth division

Fifth division

The process Note that, the second division will be the same as the first one, except the rectangle rotates by 90 degrees counter-clockwise.

Fibonacci numbers We go back to the study of the Fibonacci numbers. Remember, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, … If we denote, f(1) = 1, f(2) = 1, f(3) = 2, f(4) = 3, f(5) = 5, …, how can we write down a general formula for f(n)?

Fibonacci numbers It is not easy for us to write down a formula like, f(n) = (n + ?) / ??? It is much more easy for us to write, however, with this format. What is the relation among: f(n), f(n-1), f(n-2)?

Recursive definition It is obviously we can write down, f(n) = f(n-1) + f(n-2)

Initial conditions In order to find out any f(n) by the following formula, f(n) = f(n-1) + f(n-2) We must have two initial conditions. That is f(1) = 1 f(2) = 1

Golden section in practice

Golden section in CFA There are multiple ways in Context Free Art to draw the Golden Section. We compare the iterative and the recursive ways.

Iterative golden section startshape Golden shape Golden { drawRectangle [] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Iterative golden section

Iterative golden section startshape Golden shape Golden { rectangle [] } shape rectangle { drawRectangle [a -0.8] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Iterative golden section

Iterative golden section startshape Golden shape Golden { loop 2 [s 0.61803399 r -90 x 0.5] rectangle [] } shape rectangle { drawRectangle [a -0.8] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Iterative golden section

Iterative golden section startshape Golden shape Golden { loop 10 [s 0.61803399 r -90 x 0.5] rectangle [] } shape rectangle { drawRectangle [a -0.8] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Iterative golden section

Recursive golden section startshape Golden shape Golden { rectangle [] } shape rectangle { drawRectangle [a -0.8] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Recursive golden section

Recursive definition shape rectangle { drawRectangle [a -0.8] rectangle [?] } Note that we enter into a difficult situation. The rule rectangle refers back to itself. It seems to go into an infinite loop again and again when we have to execute the rectangle definition.

Recursive definition shape rectangle { drawRectangle [a -0.8] rectangle [?] } In order to let the Context Free Art stop, we have to make sure that each time the rectangle is drawn, it has to be smaller and smaller until it is invisible on screen. Alternately, we have to add another definition for rectangle to stop referring itself.

Recursive definition shape rectangle { drawRectangle [a -0.8] rectangle [s 0.61803399 r -90 x 0.5] } Let’s try out this.

Recursive definition startshape Golden shape Golden { rectangle [] } shape rectangle { drawRectangle [a -0.8] rectangle [s 0.61803399 r -90 x 0.5] } shape drawRectangle { SQUARE [s 1.61803399 1] }

Recursive golden section

Recursive example startshapeMyShape shape MyShape { Shape1 [] } shape Shape1 { CIRCLE [sat 1 b 1] }

Recursive example

Recursive example startshapeMyShape shape MyShape { Shape1 [] MyShape [x 1 s 0.99] } shape Shape1 { CIRCLE [sat 1 b 1] }

Recursive example

Recursive example startshapeMyShape rule MyShape { Shape1 [] MyShape [x 1 r 51 s 0.99] } shape Shape1 { CIRCLE [sat 1 b 1] }

Recursive example

Recursive example startshapeMyShape shape MyShape { Shape1 [] MyShape [x 1 r 51 s 0.99 h 51] } shape Shape1 { CIRCLE [sat 1 b 1] }

Recursive example

Spiral example

Spiral example startshapeMyShape CF::Background = [b -1] shape MyShape { Shape1 [] } shape Shape1 { Shape1 [s .95 x 2 r 12 b .5 hue 10 sat 1] Block [] } shape Block { CIRCLE [] }

Spiral example startshapeMyShape CF::Background = [b -1] shape MyShape { loop 4 [r 90] Shape1 [] } shape Shape1 { Shape1 [s .95 x 2 r 12 b .5 hue 10 sat 1] Block [] } shape Block { CIRCLE [] }

Spiral example

Spiral example startshapeMyShape CF::Background = [b -1] shape MyShape { loop 2 [r 180] Shape1 [] } shape Shape1 { Shape1 [s 0.95 x 2 r 12 b 0.5 hue 10 sat 1] Block [] } shape Block { CIRCLE [] MyShape [s 0.25] }

Spiral example

Spiral example startshapeMyShape CF::Background = [b -1] shape MyShape { loop 2 [r 180] Shape1 [x -2 flip 45] } shape Shape1 { Shape1 [s 0.95 x 2 r 12 b 0.5 hue 10 sat 1] Block [] } shape Block { CIRCLE [] MyShape [s 0.25 flip 45] }

Spiral example

More example

This class will continue to elaborate the relationship between number and visual composition. Lecture topics. ... Welcome to the course Evolutionary Graphics.

Read more

... //www.rug.nl/research/portal/en/organisations/centre-for-ecological-and-evolutionary ... .html 2014-03 -10T12:11:56Z. https ... Graphics Read more

Ergebnis für: C-Klasse (ab 03/2014) Karosserie Erstzulassung Kilometer Preis; C 180 Limousine - Palladiumsilber: Limousine: 11.2014: 24.800 km: 25.700 ...

Read more

AN indicator-based selection multi-objective evolutionary algorithm with preference for multi-class ensemble Full Text Sign ... 13-16 July 2014 Page(s):

Read more

Evolutionary game based access class barring for machine-to-machine communications Full Text Sign ... 10.1109/ICACT.2014.6779076 Publisher: IEEE

Read more

October 03, 2014. Apple Seeks ... the top layer of the icon as noted in the evolutionary Passbook icon graphic ... International Class 009 which ...

Read more

... a premier publication outlet for evolutionary psychological research, we are ... Evolutionary Psychology has a very ... 2014 by Robert Kurzban. Thanks ...

Read more

Unter anderem die A-Klasse, B-Klasse, C-Klasse, E ... C-Klasse (ab 03/2014) Karosserie ... C 180 Limousine - Iridiumsilber: Limousine: 10.2014: 25.100 km: ...

Read more

Klasse Wir Singen - Oberhausen 29.03.2014 ... Klasse Wie Singen - Oberhausen 29.03.2014 - Duration: 4:42. by Iliana Leokadia 584 views. 4:42

Read more

## Add a comment