What I'm looking for is an algorithm to find the details on the intersection of of a circle and rectangle in two dimensional Euclidean space.(adsbygoogle = window.adsbygoogle || []).push({});

The information I need to find is straightforward enough; all I need is to know whether the rectangle and circle are not intersecting, partially intersecting, or fully intersecting.

So far what I have for finding if the rectangle is fully contained in the square is this:

- Do a bounds check on the circle center
- Is the center within the rectangle on the X axis and Y axis?
- If so, is the distance from the bottom left corner of the rectangle to the center, along with the top right corner to the center greater then the radius of the circle?
- So, if these three conditions are true, then the rectangle is within the circle

If the first condition, the bounds check is true, but the others are not can I safely assume that there is a partial intersection going on? I can see this will catch the case of the circle being fully in the square as well. I also know if one corner is in, but the other is not then it is a partial intersection.

Are there any other cases I should be worrying about?

As for the case where non

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# 2D Circle and rectangle intersection tests

**Physics Forums | Science Articles, Homework Help, Discussion**