|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.util.MultiInterpolator
public class MultiInterpolator
A sequence of Interpolators each of which is active for a particular range of x. For those ranges of x not covered by interpolators added with addInterpolator() a default LinearInterpolator is used if setInterp() is called, in which case the default's slope is set with setInterp() If the ranges of all interpolators are contiguous (with no "holes"), this linear interpolator will never be used. If a nonlinear default Interpolator is desired, use setDefaultInterpolator() Assumes interpolators added with addInterpolator() are added in increasing sorted x-range order.
Constructor Summary | |
---|---|
MultiInterpolator()
|
Method Summary | |
---|---|
void |
addInterpolator(Interpolator interp,
double startX,
double endX)
Add an interpolator and associate it with specified range of x values [startx, endX) |
Interpolator |
getDefaultInterpolator()
|
Interpolator |
getLastUsedInterpolator()
|
double |
interp(double x)
Locates the interpolator associated with range including x, and returns f(x) Values of x that are not in range of any interpolators added with addInterpolator() are passed to the default interpolator's interp() method. |
static void |
main(java.lang.String[] args)
Open a frame with a canvas a draw into it using MultiInterpolator |
void |
setDefaultInterpolator(Interpolator interpolator)
Set the Interpolator to be used if x sent to interp() does not fall in the range of any added Interpolators Only practical reason to use this is if the default interpolator should be something other than a LinearInterpolator (in which case just use setInterp() ) |
void |
setInterp(double x1,
double y1,
double x2,
double y2)
Sets slope of a default LinearInterpolator which is used to calculate f(x) where x is not in range of any interpolators added by addInterpolator() |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiInterpolator()
Method Detail |
---|
public void addInterpolator(Interpolator interp, double startX, double endX)
public void setInterp(double x1, double y1, double x2, double y2)
setInterp
in interface Interpolator
public Interpolator getDefaultInterpolator()
public void setDefaultInterpolator(Interpolator interpolator)
public double interp(double x)
interp
in interface Interpolator
public Interpolator getLastUsedInterpolator()
public static void main(java.lang.String[] args)
... LinearInterpolator interp1 = new LinearInterpolator(0, 0, 100, 100); LinearInterpolator interp2 = new LinearInterpolator(100, 100, 200, 0); ExponentialInterpolator interp3 = new ExponentialInterpolator(200, 0, 300, 400); interp3.setSteepness(9); ExponentialDecayInterpolator interp4 = new ExponentialDecayInterpolator(300, 400, 500, 0); interp4.setSteepness(2); MultiInterpolator multi = new MultiInterpolator(); multi.setInterp(0, 0, 200, 20); multi.addInterpolator(interp1, 0, 50); multi.addInterpolator(interp2, 100, 200); multi.addInterpolator(interp3, 200, 300); multi.addInterpolator(interp4, 300, 400);
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |