- #1
TannerB
- 3
- 0
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.
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:
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
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