I realize that the noise() function won’t go all the way to 1.0, but I’d think that it would at least get as high as 0.999, but it only reaches around 0.846, and it only goes down to about 0.0735. That means when I’m plotting random x,y values based on noise(), the x and y never reaches the edges.
In my example below, the plot never reaches the edges. It clumps around the center, which is what I expect and actually want, but I get nothing on the edge. Right now I fix the problem with map(noise(time),0.1,0.8,0,width-1) and constrain the result between 0 and width-1 for the few times it runs outside that range.
Is there a better way to handle this? Is noise() bugged or is this expected with Perlin noise?
.
float minNoiseX = 1;
float maxNoiseX = 0;
float minNoiseY = 1;
float maxNoiseY = 0;
float noiseX, noiseY;
void setup() {
size(800,800);
background(255);
}
void draw() {
stroke(0);
for(int i = 0; i < 1000; i++) {
noiseX = noise(random(1000));
noiseY = noise(random(1000));
if(noiseX < minNoiseX) minNoiseX = noiseX;
if(noiseX > maxNoiseX) maxNoiseX = noiseX;
if(noiseY < minNoiseY) minNoiseY = noiseY;
if(noiseY > maxNoiseY) maxNoiseY = noiseY;
point(noiseX*width,noiseY*height);
}
}
void mouseClicked() {
println("minNoiseX = "+str(minNoiseX)+" : minNoiseY = "+str(minNoiseY));
println("maxNoiseX = "+str(maxNoiseX)+" : maxNoiseY = "+str(maxNoiseY));
}