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 & HelpSyntax Questions › using perlin noise to create a rough boundary
Page Index Toggle Pages: 1
using perlin noise to create a rough boundary (Read 552 times)
using perlin noise to create a rough boundary
Feb 2nd, 2009, 8:09am
 
I have never used perlin before and am trying to get my head around a use I have for it...well I think it could do what I want but I am open to suggestions. I have ellipses which I would like to use a base geometry from which to slightly randomize or create a 'natural' looking edge. I imagine that there might be a way to draw a circle using a number of bezier or other curve type points and I would use some noise like function to slightly shift each of the points off their neutral position...

anyone have any ideas ho I might do this?
thanks
Re: using perlin noise to create a rough boundary
Reply #1 - Feb 2nd, 2009, 9:53am
 
You can use curveVetex. Simple create a list of minimal 5 points on circle and add perlin noise to the radius in every step:

Code:

beginShape();
int rad =100;
float steps = 10.0;
loat strangeFactor = 10.0;
for(int i=0; i<steps ; i++){
float x=cos(TWO_PI/steps*i)*(rad+perlinNoise(i)*strangeFactor);
float y=sin(TWO_PI/steps*i)*(rad+perlinNoise(i)*strangeFactor);
curveVeretx();
}
endShape();

Re: using perlin noise to create a rough boundary
Reply #2 - Feb 2nd, 2009, 11:40pm
 
thanks! do I need a toxi library in order for the perlinNoise function to work?

this is the way I implemented it -i couldn't find a perlinNoise function

   float rad  = diameter/2;
     float steps = 10.0;
     float strangeFactor = 5.0;
     
     beginShape();
     for(int i=0; i<steps ; i++){
       float x=this.p.position().x()+cos(TWO_PI/steps*i)*(rad+noise(i)*strangeFactor);
       float y=this.p.position().y()+sin(TWO_PI/steps*i)*(rad+noise(i)*strangeFactor);
       curveVertex(x, y);
     }
     endShape();  

each roughened circle ends up looking exactly the same. what's the best way to get them to look different - should I be using the random function instead?

Re: using perlin noise to create a rough boundary
Reply #3 - Feb 3rd, 2009, 12:59am
 
I think eskimoblood meant noise() instead.
You need to use noiseSeed() to vary the results a bit, or make noise() depend on time, along or along i, etc.
Page Index Toggle Pages: 1