Skip to main content

SimplexNoise

A class in Root.Township, the global namespace.

Simplex noise in 2, 3 or 4 dimensions, with per-instance offsets added to the inputs.

Constructors​

MemberWhat it is
SimplexNoise(double offsetX, double offsetY, double offsetZ, double offsetW)Creates a SimplexNoise from offsetX, offsetY, offsetZ and offsetW.

Fields​

15 private and internal fields
MemberWhat it is
private static double F22D skew factor for simplex noise.
private static double F33D skew factor.
private static double F44D skew factor.
private static double G22D unskew factor.
private static double G33D unskew factor.
private static double G44D unskew factor.
private static SimplexNoise.Grad[] grad3The 12 gradient directions for 2D and 3D noise.
private static SimplexNoise.Grad[] grad4The 32 gradient directions for 4D noise.
private double offsetWAdded to the w input, so noise objects with different offsets give different patterns.
private double offsetXAdded to the x input.
private double offsetYAdded to the y input.
private double offsetZAdded to the z input.
private static short[] pThe fixed 256-entry permutation table. All instances share it, so the offsets are the only seed.
private short[] permp doubled to 512 entries to avoid wrapping.
private short[] permMod12perm values mod 12, to index grad3.

Methods​

MemberWhat it is
double Noise(double xin, double yin)Noise value at the point, in the range -1 to 1.
double Noise(double xin, double yin, double zin)Noise value at the point, in the range -1 to 1.
double Noise(double x, double y, double z, double w)Noise value at the point, in the range -1 to 1.
double Noise01(double x, double y)Noise value at the point, rescaled to 0 to 1.
double Noise01(double x, double y, double z)Noise value at the point, rescaled to 0 to 1.
double Noise01(double x, double y, double z, double w)Noise value at the point, rescaled to 0 to 1.
4 private and internal methods
MemberWhat it is
private static double dot(SimplexNoise.Grad g, double x, double y)Dot product of a gradient with a 2D, 3D or 4D offset.
private static double dot(SimplexNoise.Grad g, double x, double y, double z)Dot product of a gradient with a 2D, 3D or 4D offset.
private static double dot(SimplexNoise.Grad g, double x, double y, double z, double w)Dot product of a gradient with a 2D, 3D or 4D offset.
private static int fastfloor(double x)Floor of a double as an int, faster than Math.Floor.

Used in​

Members of other types that take, return or hold a SimplexNoise: