Package jme3utilities.math.noise
Class Perlin2
java.lang.Object
jme3utilities.math.noise.Perlin2
- All Implemented Interfaces:
Noise2
2-dimensional Perlin noise generator.
-
Constructor Summary
ConstructorsConstructorDescriptionPerlin2(int period, int numGradients, long gSeed, long pSeed) Instantiate a generator with specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionfloatsample(float sampleX, float sampleY) Sample the noise function at a specified point.floatsampleNormalized(float sampleX, float sampleY) Sample the noise function at a specified point and normalize it to the range [-1, 1].
-
Constructor Details
-
Perlin2
public Perlin2(int period, int numGradients, long gSeed, long pSeed) Instantiate a generator with specified parameters.- Parameters:
period- coordinate value at which the function repeats itself (≥numGradients)numGradients- number of distinct gradients (≥2)gSeed- seed for generating gradientspSeed- seed for generating the permutation
-
-
Method Details
-
sample
public float sample(float sampleX, float sampleY) Sample the noise function at a specified point. -
sampleNormalized
public float sampleNormalized(float sampleX, float sampleY) Sample the noise function at a specified point and normalize it to the range [-1, 1].- Specified by:
sampleNormalizedin interfaceNoise2- Parameters:
sampleX- the first coordinate of the sample pointsampleY- the 2nd coordinate of the sample point- Returns:
- normalized noise value (≤1, ≥-1)
-