Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

beziere curve function

/**
     * @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);
}
 
PREVIOUS NEXT
Tagged: #beziere #curve #function
ADD COMMENT
Topic
Name
8+6 =