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 it for a game.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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