# ellipse collision detection

This topic is 5402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am writing a program that involves a point bouncing around inside an ellipse, and I'm having trouble telling when the point has hit the edge of the ellipse. The ellipse is centered at the origin. Here's psuedocode of my if statement that checks for collisions. if(point.x >= cos(angle_point_makes_with_origin)*Ellipse.XRadius && point.y >= sin(angle_point_makes_with_origin)*Ellipse.YRadius) I don't see what's wrong with this. Does anyone else?

##### Share on other sites
I think it's possible to reduce this problem to a point in unit sphere problem which should be quite easy to solve - try to devide the point x/y position though the elipse radi...

Have a look at http://www.peroxide.dk/papers/collision/collision.pdf -
section 'Ellipsoid space'. (I like this really nice trick :)

##### Share on other sites
Didnt follow the link so this may have already been solved by the second poster, but, yeah. the common method should be to transform your ellipse to a unit spehere and apply the same transform to your other geometry you will test.

##### Share on other sites
This is just a 2D ellipse, so I'm not sure if the sphere stuff applies. I could apply the transformation stuff, especially since the program starts off with a circle and I keep track of the ellipse by scaling the circle on each axis.

What I'd really like though is a function that could take in an angle as a parameter and return a 2D vector that contains the radii of the ellipse at that angle.

##### Share on other sites
Ok, I figured it out. I basically used the pythagorean theorem:

(I used ^ like in math just to make it shorter).

Most of my problems actually came from other parts of the code.

• 21
• 16
• 9
• 17
• 13