From cc72cd11718612dade51232b564e9d3bf04efae1 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Fri, 15 May 2020 10:20:54 +0200 Subject: [PATCH] Added comment with the range of the noise functions. --- noise/perlin.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/noise/perlin.go b/noise/perlin.go index 07cd30f..8ed1773 100644 --- a/noise/perlin.go +++ b/noise/perlin.go @@ -30,6 +30,7 @@ func perlinLerp(t, a, b float64) float64 { return a + t*(b-a) } func perlinAt2D(q [2]float64, rx, ry float64) float64 { return rx*q[0] + ry*q[1] } +// noise2d generates 2-dimensional noise. The result is in range [-sqrt(1/4),sqrt(1/4)]. func (p *Perlin) noise1d(x float64) float64 { tx := x + perlinN bx0 := int(tx) & perlinBM @@ -44,6 +45,7 @@ func (p *Perlin) noise1d(x float64) float64 { return perlinLerp(sx, u, v) } +// noise2d generates 2-dimensional noise. The result is in range [-sqrt(1/2),sqrt(1/2)]. func (p *Perlin) noise2d(x, y float64) float64 { tx := x + perlinN bx0 := int(tx) & perlinBM