# Circle rectangle collision

This topic is 3031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to determine if a 2D circle is intersecting with a 2D rectangle. Is this simple as finding the distance between the center of the circle and the center of the rectangle and checking if that distance is less than the diameter of the circle?

##### Share on other sites
Quote:
 Is this simple as finding the distance between the center of the circle and the center of the rectangle and checking if that distance is less than the diameter of the circle?
That won't work for a circle and a box, no. (What you describe is how you would test for intersection between two circles or spheres.)

One way to test for intersection between a circle (or sphere) and a box is to find the point on the box closest to the circle/sphere center, and then compare the distance (or squared distance) from this point to the circle/sphere center to the circle/sphere's radius (or squared radius).

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633722
• Total Posts
3013549
×