noise :: Noise :: defaultinit
# 2D noise generator
abstract class Noise
# Get the noise value at `x`, `y`
#
# The coordinates `x`, `y` can be floats of any size.
#
# Returns a value between or equal to `min` and `max`.
fun [](x, y: Float): Float is abstract
# Lowest possible value returned by `[]`
#
# Default at `0.0`.
#
# Require: `min < max`
var min = 0.0 is writable
# Highest possible value returned by `[]`
#
# Default at `1.0`.
#
# Require: `min < max`
var max = 1.0 is writable
# Distance between reference points of the noise
#
# Higher values will result in smoother noise and
# lower values will result in steeper curves.
#
# Default at `1.0`.
var period = 1.0 is writable
# Amplitude of the values returned by `[]`
fun amplitude: Float do return max - min
# Set the desired amplitude of the values returned by `[]`
#
# Will only modify `max`, `min` stays the same.
fun amplitude=(value: Float) do max = min + value
# Frequency of this noise
fun frequency: Float do return 1.0/period
# Set the frequency if this noise
fun frequency=(value: Float) do period = 1.0/value
# Seed to the random number generator `gradient_vector`
#
# By default, `seed` has a random value created with `Int::rand`.
var seed: Int = 19511359.rand is lazy, writable
end
lib/noise/noise.nit:20,1--70,3