How to detect if an ellipse collides with an another ellipse / rectangle
I want to detect if ellipse collides with another ellipse and rectangle. How I can do it?
I'm writing in C++. I want to use i开发者_JAVA技巧t for a game.
If this is for a game, then exactness should not be an issue. Treat your ellipse as a polygon, that is, choose N evenly distributed points on your ellipse and treat is as a polygon. Adjuct N to the level of the desired correctness.
Now you need to test if a convex polygon collides with a rectangle. And the latter is a convex polygon as well. Here's a link for convex polygon collision detection
If you need precise answer, than you have to describe your figures as functions and use Newton's method for finding intersection points
精彩评论