Package toxi.math

Class DecimatedInterpolation

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

public class DecimatedInterpolation extends Object implements InterpolateStrategy
Delivers a number of decimated/stepped values for a given interval. E.g. by using 5 steps the interpolation factor is decimated to: 0, 20, 40, 60, 80 and 100%. By default LinearInterpolation is used, however any other InterpolateStrategy can be specified via the constructor.
  • Field Details

  • Constructor Details

    • DecimatedInterpolation

      public DecimatedInterpolation(int steps)
    • DecimatedInterpolation

      public DecimatedInterpolation(int steps, InterpolateStrategy strategy)
  • 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