# how to intersection test two polygons

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

## 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 on other sites
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 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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×