Simplex
extends Noise
in package
Generates simplex-based noise.
This is a modified version of the freely published version in the paper by Stefan Gustavson at http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
Table of Contents
- F2 = 0.5 * (\M_SQRT3 - 1)
- F3 = 1.0 / 3.0
- G2 = (3 - \M_SQRT3) / 6
- G22 = self::G2 * 2.0 - 1
- G3 = 1.0 / 6.0
- grad3 = [[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0], [1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1], [0, 1, 1], [0, -1, 1], [0, 1, -1], [0, -1, -1]]
- $expansion : float
- $octaves : int
- $offsetX : float
- $offsetY : float
- $offsetZ : float
- $perm : array<string|int, int>
- $persistence : float
- __construct() : mixed
- bilinearLerp() : float
- getFastNoise1D() : SplFixedArray|array<string|int, float>
- getFastNoise2D() : SplFixedArray|array<string|int, array<string|int, float>>
- getFastNoise3D() : array<string|int, array<string|int, array<string|int, float>>>
- getNoise2D() : float
- getNoise3D() : float
- linearLerp() : float
- noise2D() : float
- noise3D() : float
- trilinearLerp() : float
Constants
F2
protected
mixed
F2
= 0.5 * (\M_SQRT3 - 1)
F3
protected
mixed
F3
= 1.0 / 3.0
G2
protected
mixed
G2
= (3 - \M_SQRT3) / 6
G22
protected
mixed
G22
= self::G2 * 2.0 - 1
G3
protected
mixed
G3
= 1.0 / 6.0
grad3
protected
mixed
grad3
= [[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0], [1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1], [0, 1, 1], [0, -1, 1], [0, 1, -1], [0, -1, -1]]
Properties
$expansion
protected
float
$expansion
$octaves
protected
int
$octaves
$offsetX
protected
float
$offsetX
$offsetY
protected
float
$offsetY
$offsetZ
protected
float
$offsetZ
$perm
protected
array<string|int, int>
$perm
= []
$persistence
protected
float
$persistence
Methods
__construct()
public
__construct(Random $random, int $octaves, float $persistence, float $expansion) : mixed
Parameters
- $random : Random
- $octaves : int
- $persistence : float
- $expansion : float
Return values
mixed —bilinearLerp()
public
static bilinearLerp(float $x, float $y, float $q00, float $q01, float $q10, float $q11, float $x1, float $x2, float $y1, float $y2) : float
Parameters
- $x : float
- $y : float
- $q00 : float
- $q01 : float
- $q10 : float
- $q11 : float
- $x1 : float
- $x2 : float
- $y1 : float
- $y2 : float
Return values
float —getFastNoise1D()
public
getFastNoise1D(int $xSize, int $samplingRate, int $x, int $y, int $z) : SplFixedArray|array<string|int, float>
Parameters
- $xSize : int
- $samplingRate : int
- $x : int
- $y : int
- $z : int
Tags
Return values
SplFixedArray|array<string|int, float> —getFastNoise2D()
public
getFastNoise2D(int $xSize, int $zSize, int $samplingRate, int $x, int $y, int $z) : SplFixedArray|array<string|int, array<string|int, float>>
Parameters
- $xSize : int
- $zSize : int
- $samplingRate : int
- $x : int
- $y : int
- $z : int
Tags
Return values
SplFixedArray|array<string|int, array<string|int, float>> —getFastNoise3D()
public
getFastNoise3D(int $xSize, int $ySize, int $zSize, int $xSamplingRate, int $ySamplingRate, int $zSamplingRate, int $x, int $y, int $z) : array<string|int, array<string|int, array<string|int, float>>>
Parameters
- $xSize : int
- $ySize : int
- $zSize : int
- $xSamplingRate : int
- $ySamplingRate : int
- $zSamplingRate : int
- $x : int
- $y : int
- $z : int
Return values
array<string|int, array<string|int, array<string|int, float>>> —getNoise2D()
public
getNoise2D(float $x, float $y) : float
Parameters
- $x : float
- $y : float
Return values
float —getNoise3D()
public
getNoise3D(mixed $x, mixed $y, mixed $z) : float
Parameters
- $x : mixed
- $y : mixed
- $z : mixed
Return values
float —linearLerp()
public
static linearLerp(float $x, float $x1, float $x2, float $q0, float $q1) : float
Parameters
- $x : float
- $x1 : float
- $x2 : float
- $q0 : float
- $q1 : float
Return values
float —noise2D()
public
noise2D(float $x, float $z[, bool $normalized = false ]) : float
Parameters
- $x : float
- $z : float
- $normalized : bool = false
Return values
float —noise3D()
public
noise3D(float $x, float $y, float $z[, bool $normalized = false ]) : float
Parameters
- $x : float
- $y : float
- $z : float
- $normalized : bool = false
Return values
float —trilinearLerp()
public
static trilinearLerp(float $x, float $y, float $z, float $q000, float $q001, float $q010, float $q011, float $q100, float $q101, float $q110, float $q111, float $x1, float $x2, float $y1, float $y2, float $z1, float $z2) : float
Parameters
- $x : float
- $y : float
- $z : float
- $q000 : float
- $q001 : float
- $q010 : float
- $q011 : float
- $q100 : float
- $q101 : float
- $q110 : float
- $q111 : float
- $x1 : float
- $x2 : float
- $y1 : float
- $y2 : float
- $z1 : float
- $z2 : float