Jump to content
  • Advertisement
Sign in to follow this  

Orientated ellipse collision

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. I made some ellipse to mesh collision code and it worked ok so then I wanted to make it work with an orientated ellipse. This is where it got tricky. In my original ellipse code I used a radius vector to define the ellipse and then scaled it by the inverted plane normal to get the closest point on the ellipse to a plane. For the orientated ellipse the only way I can think of to achieve this is the following procedure: 1) Take the inverse of the ellipse orientation matrix. 2) Multiply the plane normal by it. 3) Invert the rotated plane normal. 4) Scale the ellipse radius vector by the inverted, rotated plane normal. 5) Multiply the result of this by the ellipse original orientation matrix. This works but is very slow and I have to do a similar procedure to test if the closest point on a triangles edge collides with the sphere. I cant help thinking there is a simpler and faster way to do this. Any comments would be much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Well, to be honest, I'd take the same approach in this. The problem is far less complicated when trying to solve it in a frame of reference, where the ellipse is parallel to the system's X/Y axes.

I can think of something, but it's kinda raw and I'm not sure whether you have the required functionality from your gfx api. It should be fast though...
Since we're talking 2d, you could define a surface in memory, identical to your viewport, like a fullscreen buffer. Whenever you think that there is a possibility of collision between two objects, you can draw them in that buffer using a single color value for each. If you try to set a pixel that is not clear or its color is other than that object's color, this means that you're trying to draw over another object, thus you've found a collision. Furthermore, you have found the point of impact too.
Needless to say, it is far less accurate than the approach mentioned earlier, but speed doesn't come cheap!

Share this post


Link to post
Share on other sites
I'm trying a few different things to see what works well for me at the minute so i will definitly give your suggestion a try. I have never thought of it that way.

Thanks for the comments mate:0)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!