Class NormalizedSimplexNoise
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
It's generally pretty hard to get a neatly normalized coherent noise function due to the way perlin/open simplex works (gauss curve) and how random numbers are generated. So instead of trying to find the perfect normalization factor and instead try to perform some approximate normalization this class allows a small overflow and brings it down very close to the [0, 1] range using tanh().
Returns values in a range of [0..1]
public class NormalizedSimplexNoise
- Inheritance
-
NormalizedSimplexNoise
- Inherited Members
- Extension Methods
Constructors
NormalizedSimplexNoise(double[], double[], long)
public NormalizedSimplexNoise(double[] inputAmplitudes, double[] frequencies, long seed)
Parameters
Fields
frequencies
public double[] frequencies
Field Value
- double[]
inputAmplitudes
public double[] inputAmplitudes
Field Value
- double[]
octaves
public SimplexNoiseOctave[] octaves
Field Value
scaledAmplitudes2D
public double[] scaledAmplitudes2D
Field Value
- double[]
scaledAmplitudes3D
public double[] scaledAmplitudes3D
Field Value
- double[]
Methods
ForColumn(double, double[], double[], double, double)
public NormalizedSimplexNoise.ColumnNoise ForColumn(double relativeYFrequency, double[] amplitudes, double[] thresholds, double noiseX, double noiseZ)
Parameters
Returns
FromDefaultOctaves(int, double, double, long)
Generates the octaves and frequencies using following formulas freq[i] = baseFrequency * 2^i amp[i] = persistence^i
public static NormalizedSimplexNoise FromDefaultOctaves(int quantityOctaves, double baseFrequency, double persistence, long seed)
Parameters
Returns
Noise(double, double)
2d noise
public virtual double Noise(double x, double y)
Parameters
Returns
Noise(double, double, double)
3d noise
public virtual double Noise(double x, double y, double z)
Parameters
Returns
Noise(double, double, double, double[])
3d Noise using custom amplitudes
public virtual double Noise(double x, double y, double z, double[] amplitudes)
Parameters
Returns
Noise(double, double, double, double[], double[])
public double Noise(double x, double y, double z, double[] amplitudes, double[] thresholds)
Parameters
Returns
Noise(double, double, double[])
public double Noise(double x, double y, double[] thresholds)
Parameters
Returns
NoiseValueCurve(double)
public static double NoiseValueCurve(double value)
Parameters
value
double
Returns
NoiseValueCurveInverse(double)
public static double NoiseValueCurveInverse(double value)
Parameters
value
double