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 › Can you please explain me this simple sketch
Page Index Toggle Pages: 1
Can you please explain me this simple sketch ? (Read 431 times)
Can you please explain me this simple sketch ?
Apr 5th, 2009, 3:24pm
 
Hi , im stucked with this simple sketch found in the Book "Creative C and C Art"

Im mostly stucked because i dont know what it means "Nuge" "Hop" and "Rowshift" in this sketch

could you explain me ?


Also could you explain the sketch with your words please ?

thanx !!!

Code:
/*
Razor Tooth Pattern
Ira Greenberg, November 20, 2005
*/
size(300, 300);
background(0);
int totalPts = 1000;
float steps = totalPts+1;
int totalRows = 50; // needs to be < = 300
int rowShift = height/totalRows;
float rowNudge = -.4;
float rowHop = 0;
int randNudge = 5;
stroke(255);
for (int i=rowShift; i<height; i+=rowShift ){
for (int j=1; j<steps; j++){
rowHop-=rowNudge;
if (j % (1 + (int)(random(randNudge))) == 0){
rowNudge*=-1;
}
point((width/steps)*j, i+rowHop);
}
}
Re: Can you please explain me this simple sketch ?
Reply #1 - Apr 5th, 2009, 4:45pm
 
the Nudge is a static value that he switches from - and + at random
the Hop is how far away it is from the original y axis of the line
the Shift is basically the number of lines diveded by the height, so it spreads the lines out.
Page Index Toggle Pages: 1