Class Perlin2

java.lang.Object
jme3utilities.math.noise.Perlin2
All Implemented Interfaces:
Noise2

public class Perlin2 extends Object implements Noise2
2-dimensional Perlin noise generator.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Perlin2(int period, int numGradients, long gSeed, long pSeed)
    Instantiate a generator with specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    sample(float sampleX, float sampleY)
    Sample the noise function at a specified point.
    float
    sampleNormalized(float sampleX, float sampleY)
    Sample the noise function at a specified point and normalize it to the range [-1, 1].

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 gradients
      pSeed - seed for generating the permutation
  • Method Details

    • sample

      public float sample(float sampleX, float sampleY)
      Sample the noise function at a specified point.
      Specified by:
      sample in interface Noise2
      Parameters:
      sampleX - the first coordinate of the sample point
      sampleY - the 2nd coordinate of the sample point
      Returns:
      noise value (≤sqrt(0.5), ≥-sqrt(0.5))
    • 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:
      sampleNormalized in interface Noise2
      Parameters:
      sampleX - the first coordinate of the sample point
      sampleY - the 2nd coordinate of the sample point
      Returns:
      normalized noise value (≤1, ≥-1)