Class Functions

java.lang.Object
com.ardor3d.math.functions.Functions

public class Functions extends Object
Utility class containing a set of easy to use functions.
  • Constructor Details

    • Functions

      public Functions()
  • Method Details

    • constant

      public static Function3D constant(double constant)
      Parameters:
      constant - the constant
      Returns:
      a function that will always return the given constant value regardless of input
    • scaleBias

      public static Function3D scaleBias(Function3D source, double scale, double bias)
      Parameters:
      source - the source function
      scale - the scale value
      bias - the bias
      Returns:
      a function that returns (src.eval * scale) + bias.
    • abs

      public static Function3D abs(Function3D source)
      Parameters:
      source - the source function
      Returns:
      a function that returns |src.eval|
    • clamp

      public static Function3D clamp(Function3D source, double min, double max)
      Parameters:
      source - the source function
      min - the minimum
      max - the maximum
      Returns:
      a function that returns src.eval clamped to [min, max]
    • invert

      public static Function3D invert(Function3D source)
      Parameters:
      source - the source function
      Returns:
      a function that returns -(src.eval)
    • add

      public static Function3D add(Function3D sourceA, Function3D sourceB)
      Parameters:
      sourceA - the source function A
      sourceB - the source function B
      Returns:
      a function the returns srcA.eval + srcB.eval
    • multiply

      public static Function3D multiply(Function3D sourceA, Function3D sourceB)
      Parameters:
      sourceA - the source function A
      sourceB - the source function B
      Returns:
      a function the returns srcA.eval * srcB.eval
    • min

      public static Function3D min(Function3D sourceA, Function3D sourceB)
      Parameters:
      sourceA - the source function A
      sourceB - the source function B
      Returns:
      a function the returns min(srcA.eval, srcB.eval)
    • max

      public static Function3D max(Function3D sourceA, Function3D sourceB)
      Parameters:
      sourceA - the source function A
      sourceB - the source function B
      Returns:
      a function the returns max(srcA.eval, srcB.eval)
    • lerp

      public static Function3D lerp(Function3D sourceA, Function3D sourceB, double amount)
      (1-amount) * srcA.eval + (amount) * srcB.eval
      Parameters:
      sourceA - the source function A
      sourceB - the source function B
      amount - the amount
      Returns:
      a function the linear interpolation of srcA.eval and srcB.eval using the given amount.
    • rotateInput

      public static Function3D rotateInput(Function3D source, ReadOnlyMatrix3 rotation)
      Parameters:
      source - the source function
      rotation - the rotation matrix
      Returns:
      a function that rotates the 3 value tuple as a vector using the given matrix before feeding it to src.eval.
    • scaleInput

      public static Function3D scaleInput(Function3D source, double scaleX, double scaleY, double scaleZ)
      Parameters:
      source - the source function
      scaleX - the x value of the scale
      scaleY - the y value of the scale
      scaleZ - the z value of the scale
      Returns:
      a function that scales the 3 value tuple using the given values before feeding it to src.eval.
    • translateInput

      public static Function3D translateInput(Function3D source, double transX, double transY, double transZ)
      Parameters:
      source - the source function
      transX - the x value of the translation
      transY - the y value of the translation
      transZ - the z value of the translation
      Returns:
      a function that translates the 3 value tuple using the given values before feeding it to src.eval.
    • remap

      public static Function3D remap(Function3D source, double oldLow, double oldHigh, double newLow, double newHigh)
      Parameters:
      source - the source function
      oldLow - the old low value
      oldHigh - the old high value
      newLow - the new low value
      newHigh - the new high value
      Returns:
      a function that maps src.eval from a given range onto a new range.
    • simplexNoise

      public static Function3D simplexNoise()
      Returns:
      a function that returns simplex noise.