com.softsynth.jmsl.util
Class LinearInterpolator

java.lang.Object
  extended by 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
LinearInterpolator(double ex1, double why1, double ex2, double why2)
          Construct a linear interpolator that intersects two specified points
 
Method Summary
 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 Detail

LinearInterpolator

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

Method Detail

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