|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.util.ExponentialInterpolator
public class ExponentialInterpolator
Interpolate a value along an exponentially rising curve defined by two points
(x1,y1) and (x2,y2) where x1 < x2, y1 < y2.
The shape of f(x) = exp(x) on the interval [0..steepness] is fitted to the user's endpoints.
That is, (x1,y1) corresponds to (0, 1) and (x2,y2) corresponds to (1,e^steepness), and this
new curve resembles a stretched or compressed version of the exp(x) function.
steepness values around 2 or 3 are reasonably gentle. Steepness around 8 and larger gets very steep,
meaning most of your output range will be close to zero except for the very top end.
Constructor Summary | |
---|---|
ExponentialInterpolator(double x1,
double y1,
double x2,
double y2)
Construct an interpolator that fits a curve between (x1, y1) and (x2, y2) to an exponentially rising function. |
Method Summary | |
---|---|
double |
interp(double x)
Interpolate a value along exponential curve |
static void |
main(java.lang.String[] args)
Use interpolator as a random distribution function |
void |
setInterp(double x1,
double y1,
double x2,
double y2)
Set two endpoints points on the desired curve, to be shaped as f(x)=exp(x) on (0,1)..(1,e) precondition: x1 |
void |
setSteepness(double s)
Reasonable values are 2..16 |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExponentialInterpolator(double x1, double y1, double x2, double y2)
Method Detail |
---|
public void setInterp(double x1, double y1, double x2, double y2)
setInterp
in interface Interpolator
public double interp(double x)
interp
in interface Interpolator
public void setSteepness(double s)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |