/**
* @function getPoint
* @param {number} t the time value between 0 and 1
* @returns {Vector} the point at the time value
* @memberof BezierCurve
*/
function getPoint(t: number): Vector {
const x = (1 - t) * (1 - t) * this.p0.x + 2 * t * (1 - t) * this.p1.x + t * t * this.p2.x;
const y = (1 - t) * (1 - t) * this.p0.y + 2 * t * (1 - t) * this.p1.y + t * t * this.p2.y;
return new Vector(x, y);
}
/**
* @function getPoint
* @param {number} t the time value between 0 and 1
* @returns {Vector} the point at the time value
* @memberof CubicBezierCurve
*/
function getPoint(t: number): Vector {
const x = (1 - t) * (1 - t) * (1 - t) * this.p0.x + 3 * t * (1 - t) * (1 - t) * this.p1.x + 3 * t * t * (1 - t) * this.p2.x + t * t * t * this.p3.x;
const y = (1 - t) * (1 - t) * (1 - t) * this.p0.y + 3 * t * (1 - t) * (1 - t) * this.p1.y + 3 * t * t * (1 - t) * this.p2.y + t * t * t * this.p3.y;
return new Vector(x, y);
}
equivalent cubic-bezier function value