Package xal.tools

Class LinearInterpolator

java.lang.Object
xal.tools.LinearInterpolator

public final class LinearInterpolator extends Object
LinearInterpolator calculates the linear interpolated value at at any point within the bounds of an array of values.
Author:
tap
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final double
     
    protected final double
     
    protected final double[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinearInterpolator(double[] values, double start, double step)
    Creates a new instance of Interpolator.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    calcValueAt(double point)
    Calculate the interpolated value at the specified point in the domain.

    Methods inherited from class java.lang.Object

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

    • values

      protected final double[] values
    • start

      protected final double start
    • step

      protected final double step
  • Constructor Details

    • LinearInterpolator

      public LinearInterpolator(double[] values, double start, double step)
      Creates a new instance of Interpolator.
      Parameters:
      values - is the array of values at fixed intervals.
      start - is the start of the domain of points and corresponds to the first array element
      step - is the step in the domain for each successive element in the array
  • Method Details

    • calcValueAt

      public double calcValueAt(double point) throws ArrayIndexOutOfBoundsException
      Calculate the interpolated value at the specified point in the domain. The point must reside within the domain of points from start to start + step * values.length.
      Parameters:
      point - The point in the domain for which we should interpolate the value.
      Returns:
      The interpolated value.
      Throws:
      ArrayIndexOutOfBoundsException - if the point does not fall int the accepted domain