Class LinearInterpolator

java.lang.Object
com.softsynth.jmsl.util.LinearInterpolator
All Implemented Interfaces:
Interpolator

public class LinearInterpolator
extends java.lang.Object
implements Interpolator
Interpolate a value along a line defined by two points (x1,y1) and (x2,y2)
Author:
Phil Burk and Nick Didkovsky
  • Constructor Summary

    Constructors
    Constructor Description
    LinearInterpolator​(double x1, double y1, double slope)  
    LinearInterpolator​(double ex1, double why1, double ex2, double why2)
    Construct a linear interpolator that intersects two specified points
  • Method Summary

    Modifier and Type Method Description
    double interp​(double x)
    Given the input x, return the y along the interpolator's linear function
    static void main​(java.lang.String[] args)
    build an interpolator and print 20 points along the line
    void setInterp​(double ex1, double why1, double ex2, double why2)
    Set the interpolator to calculate points along the line intersecting two specified points
    java.lang.String toString()
    print me

    Methods inherited from class java.lang.Object

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

    • LinearInterpolator

      public LinearInterpolator​(double x1, double y1, double slope)
    • LinearInterpolator

      public LinearInterpolator​(double ex1, double why1, double ex2, double why2)
      Construct a linear interpolator that intersects two specified points
  • Method Details

    • setInterp

      public void setInterp​(double ex1, double why1, double ex2, double why2)
      Set the interpolator to calculate points along the line intersecting two specified points
      Specified by:
      setInterp in interface Interpolator
    • interp

      public double interp​(double x)
      Given the input x, return the y along the interpolator's linear function
      Specified by:
      interp in interface Interpolator
    • toString

      public java.lang.String toString()
      print me
      Overrides:
      toString in class java.lang.Object
    • main

      public static void main​(java.lang.String[] args)
      build an interpolator and print 20 points along the line