2

I need to know if 2 ellipses are colliding in pygame/python

I know how to detect collision between two circles using :

if radius1 + radius2 > math.sqrt(((centerx1 - centerx2)**2) + (centery1 - centery2)**2):

But is it possible to do the same between 2 ellipses? Help will be appreciated. Thanks.

PradMaster
  • 63
  • 6
  • 3
    https://math.stackexchange.com/questions/1114879/detect-if-two-ellipses-intersect – Qiu Dec 16 '20 at 12:24
  • Are the ellipses aligned to the axis? – Rabbid76 Dec 16 '20 at 13:14
  • 1
    yes....they cannot be rotated in any way – PradMaster Dec 16 '20 at 14:53
  • 1
    The problem can be reduced to the intersection of an ellipse and a circle (you can scale 1 dimension). However, there doesn't seem to be a short answer. See [Ellipse–circle and ellipse–ellipse collision detection](http://yehar.com/blog/?p=2926) and [How to detect if an ellipse intersects(collides with) a circle](https://stackoverflow.com/questions/2945337/how-to-detect-if-an-ellipse-intersectscollides-with-a-circle). The major issue is to find the closest point on the ellipse to the circle. – Rabbid76 Dec 16 '20 at 15:50

0 Answers0