4

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.

m4tx
  • 4,139
  • 5
  • 37
  • 61

2 Answers2

6

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

Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
1

If you need precise answer, than you have to describe your figures as functions and use Newton's method for finding intersection points

Hnatt
  • 5,767
  • 3
  • 32
  • 43