intersectsSegment method
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;
}