Added comment with the range of the noise functions.
This commit is contained in:
parent
52494022f6
commit
cc72cd1171
@ -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] }
|
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 {
|
func (p *Perlin) noise1d(x float64) float64 {
|
||||||
tx := x + perlinN
|
tx := x + perlinN
|
||||||
bx0 := int(tx) & perlinBM
|
bx0 := int(tx) & perlinBM
|
||||||
@ -44,6 +45,7 @@ func (p *Perlin) noise1d(x float64) float64 {
|
|||||||
return perlinLerp(sx, u, v)
|
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 {
|
func (p *Perlin) noise2d(x, y float64) float64 {
|
||||||
tx := x + perlinN
|
tx := x + perlinN
|
||||||
bx0 := int(tx) & perlinBM
|
bx0 := int(tx) & perlinBM
|
||||||
|
Loading…
Reference in New Issue
Block a user