function getRotations(a) {
    var segCount = a.length;
    var pointCount = segCount - 1;

    return a.map(function (_, idx) { return a.map(function (__, i) {
      var oldSegIdx = idx + i;
      var seg;

      if (i === 0 || (a[oldSegIdx] && a[oldSegIdx][0] === 'M')) {
        seg = a[oldSegIdx];
        return ['M' ].concat( seg.slice(-2));
      }
      if (oldSegIdx >= segCount) { oldSegIdx -= pointCount; }
      return a[oldSegIdx];
    }); });
  }
Returns all possible path rotations for `curveArray`.
@param {SVGPath.curveArray} a the source `curveArray`
@returns {SVGPath.curveArray[]} all rotations for source