Perlin Noise: Using map() unnecessarily?
pamelafox opened this issue · 1 comments
pamelafox commented
This feedback came from a tester of the Khan port of Nature of Code:
Noise always returns 0-1 -
Mapping to any range would simply be n * + much like the formula for deviation in the Randomness section: num * standardDeviation + mean. It would seem in this case using map() is overkill.
Example code:
this.x = map(noise(this.tx), 0, 1, 0, width);
this.y = map(noise(this.ty), 0, 1, 0, height);
Compared to:
this.x = noise(this.tx) * width;
this.y = noise(this.ty) * height;
What's the motivation for using map()?
shiffman commented
no reason! I was probably just demonstrating how map()
works at one point. Feel free to adjust.