function getControlPoints(x0, y0, x1, y1, x2, y2, tension) {

    var pow = Math.pow,
      sqrt = Math.sqrt,
      d01, d12, fa, fb, p1x, p1y, p2x, p2y;

    //  Scaling factors: distances from this knot to the previous and following knots.
    d01 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
    d12 = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));

    fa = tension * d01 / (d01 + d12);
    fb = tension - fa;

    p1x = x1 + fa * (x0 - x2);
    p1y = y1 + fa * (y0 - y2);

    p2x = x1 - fb * (x0 - x2);
    p2y = y1 - fb * (y0 - y2);

    return [p1x, p1y, p2x, p2y];
  }
@param {Number} x0, y0, x1, y1: coordinates of the end (knot) points of the segment
@param {Number} x2, y2: the next knot (not connected, but needed to calculate p2)
@param {Number} tension: control how far the control points spread
@return {Array}: p1 -> control point, from x1 back toward x0
         p2 -> the next control point, returned to become the next segment's p1

@api private