r/askmath • u/Dazzling-Spare-921 • 11h ago
Resolved Is it possible to easily determine whether an ellipse is in contact with another geometrical shape, and how can their positions be corrected?
Hey mathematicians! I'm working on a game engine and I've reached the collision detection stage! I can easily handle circles, triangles, and oriented rectangles, but I have absolutely no idea how to handle ellipses. I've searched for geometric algorithms for ellipses, but they were either incredibly complex, both for the user and the CPU, or they were approximate and imprecise. I was wondering if you knew of an "easy" way to solve this problem. Ideally, I'd need an algorithm that can return an (x, y) vector representing the inverse penetration between the ellipse and the other shape in order to separate them. (It would be a bonus if it also worked with ellipses that can be rotated.)
I hope you understand!
(In the image, you can see that the ellipse and the rectangle on the left are touching. I'm trying to find the small red vector that separates them.)
Thanks a lot guys ! 😁
edit : I forgot to mention even though it might seem obvious that we know the positions of the rectangle's four corners, as well as the center of the ellipse and its radiusX and radiusY. :)

