We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › golden ratio
Page Index Toggle Pages: 1
golden ratio (Read 1358 times)
golden ratio
Sep 29th, 2006, 11:36am
 
hi, i'm totally newbie to this...
i try to programme a simple prototype animation which does this;

1. Construct a unit square.
2. Draw a line from the midpoint of one side to an opposite corner.
3. Use that line as the radius to draw an arc that defines the long dimension of the rectangle.

4. repeat....so on...

(better explanation;
http://en.wikipedia.org/wiki/Golden_ratio)

i'm trying to do an animation wichi does this golden rectangle over and over again until the last one becomes smaller than a pixel...it'll be presented with a performance and a photo exhibition of new archtecture...

i think it's simple for those who knows Processing, but for me, it's really brain-destroyer!!!
but if i see one time how it's done, then i think i can understand things...so plz give me any idea of how i can, at least, strat out...

many many thanks
Re: golden ratio
Reply #1 - Sep 30th, 2006, 5:41pm
 
What you're looking for is a Fibonacci spiral.

http://www.geocities.com/robinhuiscool/Goldenratio.html

If you read the page you'll find out how to make a spiral from circular arcs. There is an arc command already in Processing for you that you could bodge to do the job:

http://processing.org/reference/arc_.html

The method on the wikipedia page is fine for doing by hand. But since you're doing a presentation you can do the following:

Lie.

Simply make sure your eventual rectangles conform to 1:1.618 (the golden ratio). Draw the square, draw the radius, draw the arc and then draw the rest of the rectangle. They should all meet up. If they don't - fudge the figures a little.

Now you've got your first arc you should be able to start visualising the rest of the positions using that formula -> 1:1.618. Or even easier, look up the Fibonacci number sequence, just base it on that.

If you get stuck, post the code you've got so far.
Re: golden ratio
Reply #2 - Jan 7th, 2007, 9:03pm
 
May be this is usefull for you: http://www.companje.nl/index.php/2007/01/07/golden-spiral-built-with-processing/\

//Golden Spiral
//2007-01-06 by Rick Companje

float phi = (sqrt(5)+1)/2;

size(323,200);
translate(height/phi,0);
scale(height);
noStroke();
smooth();

for (float i=0; i > 10; i++) {
 fill(i/10*255);
 rect(0,0,1,1);
 fill(255,255,0,150);
 arc(0,0,2,2,0,PI/2);
 scale(1/phi);
 rotate(PI/2);
 translate(1/phi,0);  
}
Page Index Toggle Pages: 1