Jump to content
  • Advertisement
Sign in to follow this  
Jnz86

Triangle vs Triangle 2D

This topic is 4853 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, i have this problem: I am trying to implement collision detection of triangle vs triangle (2D) by making 3 planes of 1 triangle and testing another triangles vertices against that planes. If i found one plane that has all of the vertices on the side of normal (outside of triangle) then i consider that triangles are not colliding. This works fine, except for this: Free Image Hosting at www.ImageShack.us (ignore the yellow line) the white lines are the planes as you can see the smaller's triangle's vertices are in back of all 3 planes, and triangles don't intersect... Well, maybe i didn't understood the algorithm or something, how can i fix this if possible, or do i need to pick another algorith(links would be great)? What are common ways to solve triangle vs triangle collision detection? I was thinking about doing segments out of triangles and testing their collisions, but after that i need to check for triangle inside triangle, but i think it's going to be slower than the algorithm above. Well, anyway, your thoughts how to solve this...

Share this post


Link to post
Share on other sites
Advertisement
You're almost there - you just need to check the vertices of each triangle against the planes of the other, instead of just one. This is basically the separating axis theorem - here is a paper on the subject.

Share this post


Link to post
Share on other sites
After writing this post i went to bed. In bed i thought:
"Sh*t! I need to check the other triangle too! :))))"

Quote:

and a nice easy to follow web page here

I have seen that web already :) thnx anyway

Quote:

You're almost there - you just need to check the vertices of each triangle against the planes of the other, instead of just one. This is basically the separating axis theorem - here is a paper on the subject.

I hate papers! Why? Because i don't understand equations written in them, because of strange(unknown to me) symbols in papers.(I am 19years old, I just finished Secondary School, in school they only teach Vectors, i had to learn matrices,planes,quaternions,ray's by myself, so i dont understand those often found in papers)

r++ for both of you :)

aaa, and 1 more question,
what are other common ways of solving triangle vs triangle collision detection?

Share this post


Link to post
Share on other sites
a couple ways to go about it. Test each edge of each triangles against the edge on the other triangles, or edges against triangles directly (which takes care of one triangle being inside another triangle, but the edges not actually intersectring), basic clipping routines (cohen-sutherland clipping, using one triangle as the clipping region), or the SAT algorithm.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!