Package toxi.math

Class ThresholdInterpolation

java.lang.Object
toxi.math.ThresholdInterpolation
All Implemented Interfaces:
InterpolateStrategy

public class ThresholdInterpolation extends Object implements InterpolateStrategy
Defines a single step/threshold function which returns the min value for all factors < threshold and the max value for all others.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThresholdInterpolation(float threshold)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    interpolate(double a, double b, double f)
    Implements an interpolation equation using double precision values.
    float
    interpolate(float a, float b, float f)
    Implements an interpolation equation using float values.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • threshold

      public float threshold
  • Constructor Details

    • ThresholdInterpolation

      public ThresholdInterpolation(float threshold)
  • Method Details

    • interpolate

      public double interpolate(double a, double b, double f)
      Description copied from interface: InterpolateStrategy
      Implements an interpolation equation using double precision values.
      Specified by:
      interpolate in interface InterpolateStrategy
      Parameters:
      a - current value
      b - target value
      f - normalized interpolation factor (0.0 .. 1.0)
      Returns:
      interpolated value
    • interpolate

      public float interpolate(float a, float b, float f)
      Description copied from interface: InterpolateStrategy
      Implements an interpolation equation using float values.
      Specified by:
      interpolate in interface InterpolateStrategy
      Parameters:
      a - current value
      b - target value
      f - normalized interpolation factor (0.0 .. 1.0)
      Returns:
      interpolated value