subdivideLeft method
Changes this curve in place to be the portion of itself from t, 1
.
@param {number} t The start of the desired portion of the curve.
Implementation
void subdivideLeft(double t)
{
if (t == 1) {
return;
}
// Step one - from 4 points to 3
double ix0 = Algebra.lerp(this.x0, this.x1, t);
double iy0 = Algebra.lerp(this.y0, this.y1, t);
double ix1 = Algebra.lerp(this.x1, this.x2, t);
double iy1 = Algebra.lerp(this.y1, this.y2, t);
double ix2 = Algebra.lerp(this.x2, this.x3, t);
double iy2 = Algebra.lerp(this.y2, this.y3, t);
// Collect our new x1 and y1
this.x1 = ix0;
this.y1 = iy0;
// Step two - from 3 points to 2
ix0 = Algebra.lerp(ix0, ix1, t);
iy0 = Algebra.lerp(iy0, iy1, t);
ix1 = Algebra.lerp(ix1, ix2, t);
iy1 = Algebra.lerp(iy1, iy2, t);
// Collect our new x2 and y2
this.x2 = ix0;
this.y2 = iy0;
// Final step - last point
this.x3 = Algebra.lerp(ix0, ix1, t);
this.y3 = Algebra.lerp(iy0, iy1, t);
}