All files / core/domain/utils/geometry getQuadraticControlPoint.js

0% Statements 0/1
100% Branches 0/0
0% Functions 0/1
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16                               
/**
 * Return the control point coordinates for a quadratic bezier curve.
 *
 * @param  {number} x1  The X coordinate of the start point.
 * @param  {number} y1  The Y coordinate of the start point.
 * @param  {number} x2  The X coordinate of the end point.
 * @param  {number} y2  The Y coordinate of the end point.
 * @return {x,y}        The control point coordinates.
 */
export default function getQuadraticControlPoint(x1, y1, x2, y2) {
  return {
    x: (x1 + x2) / 2 + (y2 - y1) / 4,
    y: (y1 + y2) / 2 + (x1 - x2) / 4
  };
}