interpolation = (unitTime - keyTimes[keyTimeIndex])
/ (keyTimes[keyTimeIndex + 1] - keyTimes[keyTimeIndex]);
if (calcMode == CALC_MODE_SPLINE && unitTime != 0) {
// XXX This could be done better, e.g. with
// Newton-Raphson.
Cubic c = keySplineCubics[keyTimeIndex];
float tolerance = 0.001f;
float min = 0;
float max = 1;
Point2D.Double p;
for (;;) {
float t = (min + max) / 2;
p = c.eval(t);
double x = p.getX();
if (Math.abs(x - interpolation) < tolerance) {
break;
}
if (x < interpolation) {