intersectsSegment method

bool intersectsSegment(
  1. Vector2 pointA,
  2. Vector2 pointB
)

Whether the segment formed by pointA and pointB intersects this Rect

Implementation

bool intersectsSegment(Vector2 pointA, Vector2 pointB) {
  return min(pointA.x, pointB.x) <= right &&
      min(pointA.y, pointB.y) <= bottom &&
      max(pointA.x, pointB.x) >= left &&
      max(pointA.y, pointB.y) >= top;
}