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 › Curves 1 from Ira
Page Index Toggle Pages: 1
Curves 1 from Ira (Read 430 times)
Curves 1 from Ira
Jun 21st, 2008, 9:08pm
 
Hello today I try to modify a script from Ira for my home page hust for test

my script is here

/*
Curves 1

from ira midified size by Olivier , June 2008

*/
int steps =  300;
float[ ]x = new float[steps];
float[ ]y = new float[steps];
float[ ]xSpeed = new float[steps];
float[ ]ySpeed = new float[steps];

void setup (){
size (460, 780);
background (255);
float margin = height*.1;
smooth();
strokeWeight(1.5);
for (int i=0; i<steps; i++){
x[i]= 0;
y[i] = random(margin);
xSpeed[i] = random(.75, 1.2);
ySpeed[i] = random(1.0075, 1.04);
}

for (int i=0; i<steps;i++){
while(y[i]<height){
point(x[i], y[i]);
y [i] = random(margin);
x[i]+=xSpeed[i];
y[i]*=ySpeed[i];
}
}
}

I test this script on xp with processing 0135 it  don't run  and 0142, I think some errors inside processing or not understand this script

Olivier
Re: Curves 1 from Ira
Reply #1 - Jun 23rd, 2008, 4:10am
 
there were a couple typos in your code.
Corrected code:
Code:

/*
Curves 1
from ira midified size by Olivier , June 2008
*/
int steps = 300;
float[]x = new float[steps];
float[]y = new float[steps];
float[]xSpeed = new float[steps];
float[]ySpeed = new float[steps];

void setup (){
size(460, 780);
background(255);
float margin = height*.1;
smooth();
strokeWeight(1.5);
for (int i=0; i<steps; i++){
x[i] = 0;
y[i] = random(margin);
xSpeed[i] = random(.75, 1.2);
ySpeed[i] = random(1.0075, 1.04);
}

for (int i=0; i<steps; i++){
while(y[i]<height){
point(x[i], y[i]);
x[i]+=xSpeed[i];
y[i]*=ySpeed[i];
}
}
}


Unfortunately, some whitespace is tolerable and some is not. You had one extra space between the braces [ ] in your array declarations, which was one source of the problem. The other source was the assignment statement "y [i] = random(margin);" in your while loop causing an infinite loop. I did go back and check the original code from the book, which did not have these typos.
Re: Curves 1 from Ira
Reply #2 - Jun 23rd, 2008, 11:17am
 
Thanks for your response

Have you got an pc windows with firefox I would like to understand my error ?

when you see http://olivierbaudrydesign.free.fr/

a display window appears with javascript error and Plugins are necessary for see page.

I use firefox 3 on windows xp

Re: Curves 1 from Ira
Reply #3 - Jun 23rd, 2008, 12:02pm
 
<param name="code" value="/wp-content/themes/oupocreanum/processing/Curves1/Curves1" />
needs to be <param name="code" value="Curves1" /> I think.
Page Index Toggle Pages: 1