function getRotatedCurve(a, b) {
    var segCount = a.length - 1;
    var lineLengths = [];
    var computedIndex = 0;
    var sumLensSqrd = 0;
    var rotations = getRotations(a);

    rotations.forEach(function (_, i) {
      a.slice(1).forEach(function (__, j) {
        sumLensSqrd += distanceSquareRoot(a[(i + j) % segCount].slice(-2), b[j % segCount].slice(-2));
      });
      lineLengths[i] = sumLensSqrd;
      sumLensSqrd = 0;
    });

    computedIndex = lineLengths.indexOf(Math.min.apply(null, lineLengths));

    return rotations[computedIndex];
  }
Returns the `curveArray` rotation for the best morphing animation.
@param {SVGPath.curveArray} a the target `curveArray`
@param {SVGPath.curveArray} b the reference `curveArray`
@returns {SVGPath.curveArray} the best `a` rotation