Package toxi.math

Class CircularInterpolation

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

public class CircularInterpolation extends Object implements InterpolateStrategy
Implementation of the circular interpolation function. i = a-(b-a) * (sqrt(1 - (1 - f) * (1 - f) ))
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    CircularInterpolation(boolean isFlipped)
    The interpolation slope can be flipped to have its steepest ascent towards the end value, rather than at the beginning in the default configuration.
  • 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.
    void
    setFlipped(boolean isFlipped)
     

    Methods inherited from class java.lang.Object

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

    • CircularInterpolation

      public CircularInterpolation()
    • CircularInterpolation

      public CircularInterpolation(boolean isFlipped)
      The interpolation slope can be flipped to have its steepest ascent towards the end value, rather than at the beginning in the default configuration.
      Parameters:
      isFlipped - true, if slope is inverted
  • 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
    • setFlipped

      public void setFlipped(boolean isFlipped)