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 double
interp(double t)
Given the input t, return the value along the half cosine functionstatic void
main(java.lang.String[] args)
build an interpolator and print 20 points along the linevoid
setInterp(double t1, double v1, double t2, double v2)
Set the interpolator to calculate points along the line intersecting two specified pointsjava.lang.String
toString()
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:
setInterp
in interfaceInterpolator
-
interp
public double interp(double t)Given the input t, return the value along the half cosine function- Specified by:
interp
in interfaceInterpolator
-
toString
public java.lang.String toString()print me- Overrides:
toString
in classjava.lang.Object
-
main
public static void main(java.lang.String[] args)build an interpolator and print 20 points along the line
-