docs: function rayVsLineSegment(ray, segment) {
    var result = lineIntersect.checkIntersection(
      ray.start.x, ray.start.y, ray.end.x, ray.end.y,
      segment.start.x, segment.start.y, segment.end.x, segment.end.y
    );
  
    // definitely no intersection
    if (result.type == 'none' || result.type == 'parallel') return null;
  
    // single intersection point
    if (result.type == 'intersecting') return result.point;
  
    // colinear, so now check if ray/segment overlap
    if (segmentContainsPoint(segment, ray.start)) {
      return ray.start;
    } else {
      // return segment endpoint that is
      //   - within ray
      //   - closest to ray start
      var rayStart = new Vec2(ray.start);
      var endpointsInRay = segmentEndpointsInRay(ray, segment);
      return rayStart.nearest(endpointsInRay);
    }
  }