-
-
Notifications
You must be signed in to change notification settings - Fork 14
struct SuperSimplexNoise3D
A type of three-dimensional gradient noise (sometimes called Perlin noise), suitable for texturing arbitrary three-dimensional objects.
Three-dimensional super-simplex noise generally looks somewhat better visually than its two-dimensional counterpart, but runs about 20% slower.
init(amplitude:Double, frequency:Double, seed:Int = 0)
Creates an instance with the given
amplitude,frequency, and randomseedvalues. Creating an instance generates a new pseudo-random permutation table for that instance, and a new instance does not need to be regenerated to sample the same procedural noise field.
The given amplitude is adjusted internally to produce output approximately within the range of
-amplitude ... amplitude, however this is not strictly guaranteed.
func evaluate(_ x:Double, _ y:Double) -> Double
Evaluates the super-simplex noise field at the given
x, ycoordinates, supplying0for the missingzcoordinate.
func evaluate(_ x:Double, _ y:Double, _ z:Double) -> Double
Evaluates the super-simplex noise field at the given coordinates.
func evaluate(_ x:Double, _ y:Double, _ z:Double, _:Double) -> Double
Evaluates the super-simplex noise field at the given coordinates. The fourth coordinate is ignored.
func sample_area(width:Int, height:Int) -> [(Double, Double, Double)]
Evaluates the noise field over the given area, starting from the origin, and extending over the first quadrant, taking unit steps in both directions. Although the
xandycoordinates are returned, the output vector is guaranteed to be in row-major order.
func sample_area_saturated_to_u8(width:Int, height:Int, offset:Double = 0.5) -> [UInt8]
Evaluates the noise field over the given area, starting from the origin, and extending over the first quadrant, storing the values in a row-major array of samples. The samples are clamped, but not scaled, to the range
0 ... 255.