Package com.softsynth.jmsl.util
Class HalfCosineInterpolator
java.lang.Object
com.softsynth.jmsl.util.HalfCosineInterpolator
- All Implemented Interfaces:
Interpolator
public class HalfCosineInterpolator extends java.lang.Object implements Interpolator
Interpolate a value along an S curve (half cosine)
- Author:
- Nick Didkovsky
-
Constructor Summary
Constructors Constructor Description HalfCosineInterpolator(double t1, double v1, double t2, double v2)Construct a linear interpolator that intersects two specified points -
Method Summary
Modifier and Type Method Description doubleinterp(double t)Given the input t, return the value along the half cosine functionstatic voidmain(java.lang.String[] args)build an interpolator and print 20 points along the linevoidsetInterp(double t1, double v1, double t2, double v2)Set the interpolator to calculate points along the line intersecting two specified pointsjava.lang.StringtoString()print meMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
HalfCosineInterpolator
public HalfCosineInterpolator(double t1, double v1, double t2, double v2)Construct a linear interpolator that intersects two specified points
-
-
Method Details
-
setInterp
public void setInterp(double t1, double v1, double t2, double v2)Set the interpolator to calculate points along the line intersecting two specified points- Specified by:
setInterpin interfaceInterpolator
-
interp
public double interp(double t)Given the input t, return the value along the half cosine function- Specified by:
interpin interfaceInterpolator
-
toString
public java.lang.String toString()print me- Overrides:
toStringin classjava.lang.Object
-
main
public static void main(java.lang.String[] args)build an interpolator and print 20 points along the line
-