function supportPoint(polygon, direction) {
    let index =
      direction[1] >= 0
        ? direction[0] < 0
          ? polygon.maxY
          : polygon.maxX
        : direction[0] < 0
          ? polygon.minX
          : polygon.minY;
    let max = -Infinity;
    let value;
    while ((value = dot(polygon.list[index], direction)) > max) {
      max = value;
      index = ++index % polygon.list.length;
    }
    return polygon.list[(index || polygon.list.length) - 1];
  }
Computes farthest polygon point in particular direction. Thanks to
knowledge of min/max x and y coordinates we can choose a quadrant to search
in. Since we're working on convex hull, the dot product is increasing until
we find the farthest point.

@param {Point} polygon
@param {ReadonlyArray<number>} direction
@returns {number[]}