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