Java Utililty Methods interpolate

List of utility methods to do interpolate

Description

The list of methods to do interpolate are organized into topic(s).

Method

doubleinterpolatefinal(double a, final double b, final double d)
interpolatefinal
return approachExp(a, b, d);
floatinterpolateFloat(float f0, float f1, double mixer)
interpolate Float
return (float) (f0 * (1d - mixer) + f1 * mixer);
floatinterpolateFloat(float t, float a, float b)
Does a linear interpolation using doubles
return a + t * (b - a);
floatinterpolateLinear(final float a, final float b, final float t)
interpolate Linear
return a + t * (b - a);
floatinterpolateLinear(float lastState, float currentState, float ip)
interpolate Linear
return lastState + (currentState - lastState) * ip;
StringinterpolateProp(final String source, final String propName, final String defValue)
interpolate Prop
return source.replace("${" + propName + "}", System.getProperty(propName, defValue));
floatinterpolateRotation(float par1, float par2, float par3)
interpolate Rotation
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F) {
    ;
while (f3 >= 180.0F) {
    f3 -= 360.0F;
return par1 + par3 * f3;
...
floatinterpolateRotation(float prevRotation, float nextRotation, float partialTick)
interpolate Rotation
float rot = nextRotation - prevRotation;
while (rot >= 180.0F) {
    rot -= 360.0F;
while (rot >= 180.0F) {
    rot -= 360.0F;
return prevRotation + partialTick * rot;
...
doubleinterpolateRound(double a, double b, double t)
interpolate Round
return Math.round(interpolateNumber(a, b, t));
floatinterpolateSmoothly(final float position, final float startPosition, final float endPosition, final float startValue, final float endValue)
Calculates a smoothly (cosine) interpolated value, given a start value, an end value, and the position to get the value at.
final float relativePosition = (position - startPosition) / (endPosition - startPosition);
float result;
if (relativePosition <= 0) {
    result = startValue;
} else if (relativePosition >= 1) {
    result = endValue;
} else {
    final double relativeSmoothPosition = (1.0 - Math.cos(relativePosition * Math.PI)) / 2.0;
...