Square/Circle Overlap test

Started by
1 comment, last by Zakwayda 13 years, 6 months ago
I've been trying to calculate if a circle is inside a square. For now I can only check if the circles center is in the square.

Thanx in Advance :)

EnJOJ Gaming
Advertisement
Break the square into line segments. Check if each line segment intersects the circle if not then circle is inside if so then circle isn't inside(given what you already have ).
Quote:Original post by stonemetal
Break the square into line segments. Check if each line segment intersects the circle if not then circle is inside if so then circle isn't inside(given what you already have ).
Although you can do it this way, it shouldn't be necessary to perform per-edge tests, I don't think. You should be able to simply perform a point containment test using a square that's been 'shrunk' by the circle radius. (IINM.)

This topic is closed to new replies.

Advertisement