Jump to content
  • Advertisement
Sign in to follow this  
speciesUnknown

how to intersection test two polygons

This topic is 3982 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, Ive thought of two ways to test for the intersection of polygons. Number 1: test the two planes of the polygons agains each other to get a line along which they collide. Then, test this line agains the two polygons. If the line contacts both polygons, the intersection point is the average of the two places the line contacts the two polygons. Number 2: Treat each side of each polygon as a line. Test each line of one polygon against each line of the other and then take the average intersection point of the line with the two polygons. What other ways of doing this are there? Im currently testing both of these methods and seeing which is the fastest for 3d collision of triangles and quads.

Share this post


Link to post
Share on other sites
Advertisement
The first method sounds good, but I don't understand the second method. Checking line vs line in 3D is unlikely to ever return a collission.

The trick for a fast intersection test is to eliminate as many of the collissions as possible with simple tests before moving onto the more complex tests. For polygon tests if all the points of one polygon are on the same side of the plane of the other polygon then you know they don't collide, and you can make that test before doing anything else. I assume you've already got some type of tree or bounding spheres or something so I won't go into that.

Share this post


Link to post
Share on other sites
well, I invented them both off the top of my head, and I invented the first one while I was cooking hamburgers. Usually when i invent something, its OK but there is a better way.

To explain further: the second method is to check the lines of the first polygon against the surface of the second polygon. Then I do the same with the second set of lines against the surface of the first polygon. The average of all the collision points is the point of collision of the two polygons.

I'm currently speed testing both methods in my game engine but haven't got either to work yet, but thats just because I'm not good at maths. I intend to test them both against a few kinds of mesh before I decide which one to use.

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!