Class FbmFunction3D

java.lang.Object
com.ardor3d.math.functions.FbmFunction3D
All Implemented Interfaces:
Function3D
Direct Known Subclasses:
CloudsFunction3D

public class FbmFunction3D extends Object implements Function3D
An implementation of Fractional Brownian Motion (fBm), with configurable persistence and lacunarity (or tightness of the fractal). This function basically recursively adds the given source function (often a noise function) onto itself, shifting and scaling the sample point and value on each iteration (or octave).
See Also:
  • Constructor Details

    • FbmFunction3D

      public FbmFunction3D(Function3D source, int octaves, double frequency, double persistence, double lacunarity)
      Construct a new FbmFunction with the given params.
      Parameters:
      source - the source function we will operate on.
      octaves - the number of iterations we will perform. Called octaves because the default for each octave is double the frequency of the previous octave, a property shared by music tones. Generally a value between 4 and 8 is good.
      frequency - a scale value applied to the incoming tuple before we apply fBm. It is the number of cycles per unit for the function. Default would be 1.
      persistence - a scale value that determines how fast the amplitude decreases for each octave. Generally should be in the range [0, 1]. A lower persistence value will decrease the effect of each octave. A traditional value is 0.5
      lacunarity - a scale value that determines how fast the frequency increases for each octave (freq = prevFreq * lac.) A traditional value is 2.
  • Method Details

    • eval

      public double eval(double x, double y, double z)
      Specified by:
      eval in interface Function3D
      Parameters:
      x - the 1st value in our tuple
      y - the 2nd value in our tuple
      z - the 3rd value in our tuple
      Returns:
      some value, generally (but not necessarily) in [-1, 1]
    • getValue

      protected double getValue(double dx, double dy, double dz)
    • getSource

      public Function3D getSource()
    • setSource

      public void setSource(Function3D source)
    • getOctaves

      public int getOctaves()
    • setOctaves

      public void setOctaves(int octaves)
    • getFrequency

      public double getFrequency()
    • setFrequency

      public void setFrequency(double frequency)
    • getPersistence

      public double getPersistence()
    • setPersistence

      public void setPersistence(double persistence)
    • getLacunarity

      public double getLacunarity()
    • setLacunarity

      public void setLacunarity(double lacunarity)