Updated comments on noise maps.

This commit is contained in:
Sander Schobers 2020-05-09 19:37:21 +02:00
parent 2413c7d3d4
commit c02fb342a7

View File

@ -35,7 +35,7 @@ func clipNormalized(x float64) float64 {
return x return x
} }
// Value generates the noise value for an x/y pair. The range of the output is approximately [-1.325825214,1.325825214] (for 4 harmonics). // Value generates the noise value for an x/y pair.
func (m *noiseMap) Value(x, y int32) float64 { func (m *noiseMap) Value(x, y int32) float64 {
value := m.noise.Noise2D(float64(x)*.01, float64(y)*.01, m.alpha, m.beta, m.harmonics)*.565 + .5 value := m.noise.Noise2D(float64(x)*.01, float64(y)*.01, m.alpha, m.beta, m.harmonics)*.565 + .5
return clipNormalized(value) return clipNormalized(value)
@ -45,7 +45,7 @@ type randomNoiseMap struct {
*noise.Perlin *noise.Perlin
} }
// Value generates the noise value for an x/y pair. The range of the output is approximately [-1.325825214,1.325825214] (for 4 harmonics). // Value generates the noise value for an x/y pair.
func (m randomNoiseMap) Value(x, y int32) float64 { func (m randomNoiseMap) Value(x, y int32) float64 {
value := m.Noise2D(float64(x)*.53, float64(y)*.53, 1.01, 2, 2)*.5 + .5 value := m.Noise2D(float64(x)*.53, float64(y)*.53, 1.01, 2, 2)*.5 + .5
return clipNormalized(value) return clipNormalized(value)