Class NoiseUtils

java.lang.Object
com.github.tommyettinger.textra.utils.NoiseUtils

public class NoiseUtils extends Object
Some 1D noise methods to be used when an effect needs smooth but random changes.
  • Constructor Details

    • NoiseUtils

      public NoiseUtils()
  • Method Details

    • noise1D

      public static float noise1D(float x, int seed)
      Quilez' 1D noise, with some changes to work on the CPU. Takes a distance x and any int seed, and produces a smoothly-changing value as x goes up or down and seed stays the same. Uses a quartic curve.
      Parameters:
      x - should go up and/or down steadily and by small amounts (less than 1.0, certainly)
      seed - should stay the same for a given curve
      Returns:
      a noise value between -1.0 and 1.0
    • octaveNoise1D

      public static float octaveNoise1D(float x, int seed)
      Just gets two octaves of noise1D(float, int); still has a range of -1 to 1.
      Parameters:
      x - should go up and/or down steadily and by small amounts (less than 1.0, certainly)
      seed - should stay the same for a given curve
      Returns:
      a noise value between -1.0 and 1.0