code: function polygonIntersectLine(x, y, basePoints, centerX, centerY, width, height, padding) {
    var intersections = [];
    var intersection;
    var transformedPoints = new Array(basePoints.length);
    var doTransform = true;
  
    if (width == null) {
      doTransform = false;
    }
  
    var points;
  
    if (doTransform) {
      for (var i = 0; i < transformedPoints.length / 2; i++) {
        transformedPoints[i * 2] = basePoints[i * 2] * width + centerX;
        transformedPoints[i * 2 + 1] = basePoints[i * 2 + 1] * height + centerY;
      }
  
      if (padding > 0) {
        var expandedLineSet = expandPolygon(transformedPoints, -padding);
        points = joinLines(expandedLineSet);
      } else {
        points = transformedPoints;
      }
    } else {
      points = basePoints;
    }
  
    var currentX, currentY, nextX, nextY;
  
    for (var _i2 = 0; _i2 < points.length / 2; _i2++) {
      currentX = points[_i2 * 2];
      currentY = points[_i2 * 2 + 1];
  
      if (_i2 < points.length / 2 - 1) {
        nextX = points[(_i2 + 1) * 2];
        nextY = points[(_i2 + 1) * 2 + 1];
      } else {
        nextX = points[0];
        nextY = points[1];
      }
  
      intersection = finiteLinesIntersect(x, y, centerX, centerY, currentX, currentY, nextX, nextY);
  
      if (intersection.length !== 0) {
        intersections.push(intersection[0], intersection[1]);
      }
    }
  
    return intersections;
  }
docs: math.polygonIntersectLine( x, y, basePoints, centerX, centerY, width, height, padding ) intersect a node polygon (pts transformed)  math.polygonIntersectLine( x, y, basePoints, centerX, centerY ) intersect the points (no transform)