How to determine if an ellipse collides with another ellipse / rectangle

I want to determine if an ellipse collides with another ellipse and a rectangle. How can i do this?

I am writing in C ++. I want to use it for a game.

+4
source share
2 answers

If this is for the game, then accuracy should not be a problem. Treat your ellipse as a polygon, that is, choose N evenly distributed points on your ellipse, and treatment as a polygon. Attach N to the desired correctness level.

Now you need to check if the convex polygon collides with the rectangle. And the latter is also a convex polygon. Here is a link to convex polygon collision detection

+6
source

If you need an exact answer, you need to describe your shapes as functions and use the Newton method to find intersection points

+1
source

All Articles