Page 2 of 2

Re: Collision Detection Between Circle Segment and Rectangle

Posted: Thu Aug 10, 2023 12:14 pm
by GGfazo
First thing I wanted to say is thank you all for creating this thread, it has personally been really helpful. But I wanted to point out a possible optimization (although it might not work). In Gravy's post, it's stated that
So we check the closest point, R, S, and T, and the four corners, for a total of 8 calculations. That's not too bad. (Although we should also check to see whether the center of the circle is within the rectangle in the first place.)
However in all the cases I've found, there's never a need to check for T if we already check for the 4 corners and the closest point.
Captura de pantalla 2023-08-10 140920.png
Captura de pantalla 2023-08-10 140920.png (13.68 KiB) Viewed 428 times
Again, I could be wrong, but I'm somewhat confident about this.