Home » Community » Forums » » 2D Rotated Rectangle Collision
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 2D Rotated Rectangle Collision
Post Reply 
Nice article.
It would be interesting to see whether it can be extended to 3D?

 User Rating: 1160   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

A very nice explanation on a substantive article. Great work, and thanks for sharing.

 User Rating: 1549   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by janta
Nice article.
It would be interesting to see whether it can be extended to 3D?


I have yet to try, but I don't see an issue (you could just go face by face in each 3D rectangle). I would be curious though if anyone has ever done this method?

Anyways, I've done this in 2D as well a year ago. It worked like a charm. Great article!

 User Rating: 1166   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Outstanding! I'd like to see a 3d version of this algorithm too. I might implement one in the future. :)

 User Rating: 1022   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I have used the 3D version in the past, and it works well. David Eberly gives a fairly complete treatment of this here: http://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf

 User Rating: 1038   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I just implemented this based off your article here, and it works great. Thanks for the article!

 User Rating: 1140   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Nice article!

There is also another tutorial with interactive flash examples on the metanet's site, here is the link if someone's interested:

Click Me


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I appreciate the positive feedback I've gotten on this article; I'm glad you found it interesting and that some of you were able to put it to use.

In my project that inspired me to write this article, I didn't do any physics simulation beyond simple collision detection. However, the Separating Axis Theorem can be used to provide some excellent collision information useful for physics in addition to just detecting a collision. The games "N" and "N+" both use the Separating Axis Theorem for their collision detection and physics. I don't have the time to track it down now, but somewhere on their website: http://thewayoftheninja.org/n.html they have an article detailing how to use the Separating Axis theorem for physics.

- Eric

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hey, I can't believe my luck that this article was posted so recently.

I spent the morning learning about the Separating Axis Thereom, decided it was perfect for what I wanted, then fell into a depression imagining the struggle I was going to have applying it to my rotated rectangles. As someone who hasn't had to find a projection in over four years, I really really appreciate this hand-holding walkthrough. Thanks!

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Just one point, Squared distance is faster to calculate.

It can be wise to utilize a SQUARED radius that completely encompasses the rectangle. If the SQUARED distance between the centers of rectangles A and B is greater than the radius of A and B added together then SQUARED THEN there cannot possibly be a collision and it is unnecessary to use the separating axis theorem.

 User Rating: 86   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

A quick addition:

If you're using the Separating Axis Theorem for any kind of physics simulation, then you need to actually project the points onto the separation axes as my article instructs you to.

However, if you're just using the Separating Axis Theorem for true or false collision detection, then you can substitute a quick dot product for the projection and dot product section of the algorithm.

Basically, instead of projecting each point onto the axis and then looking for overlap using the min and max dot product of the projected points and the axis onto which they were projected, you could just look for overlap using the min and max dot product of the original points and the axis.

This would speed the algorithm up, as the dot product is quite a bit cheaper than the projection. We would need the actual projection if we were doing physics with this algorithm. However, for simple collision detection, the dot product would be enough.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: