cx, cy) with radius r, and an axis-aligned rectangle whose bottom-left corner is (left, bottom) and top-right corner is (right, top).
Both shapes are filled and include their boundary. Return True if they share at least one point, and False otherwise.r=2, cx=0, cy=0, left=2, bottom=-1, right=5, top=4 → True
The circle touches the rectangle's left side at (2, 0), so they share a point.
r=2, cx=0, cy=0, left=2, bottom=2, right=6, top=5 → False
The closest point of the rectangle is the corner (2, 2), which is 2√2 ≈ 2.83 > 2 away.
r=1, cx=3, cy=3, left=0, bottom=0, right=10, top=10 → True
The whole disk lies inside the rectangle.
r ≤ 2000cx, cy ≤ 10⁴left < right ≤ 10⁴bottom < top ≤ 10⁴r=2, cx=0, cy=0, left=2, bottom=-1, right=5, top=4
True
Run checks the first 3 tests in your browser. Submit checks all 109 tests on the server, hidden ones included.