addQuad method

dynamic addQuad(
  1. dynamic x0,
  2. dynamic y0,
  3. dynamic x1,
  4. dynamic y1,
  5. dynamic x,
  6. dynamic y,
)

Add a quadratic curve to the bounding box. This extends the bounding box to include the entire quadratic curve. @param {number} x0 - The starting X coordinate. @param {number} y0 - The starting Y coordinate. @param {number} x1 - The X coordinate of the control point. @param {number} y1 - The Y coordinate of the control point. @param {number} x - The ending X coordinate. @param {number} y - The ending Y coordinate.

Implementation

addQuad(x0, y0, x1, y1, x, y) {
    var cp1x = x0 + 2 / 3 * (x1 - x0);
    var cp1y = y0 + 2 / 3 * (y1 - y0);
    var cp2x = cp1x + 1 / 3 * (x - x0);
    var cp2y = cp1y + 1 / 3 * (y - y0);
    this.addBezier(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y);
}