how to intersection test two polygons

Started by
1 comment, last by speciesUnknown 16 years, 9 months ago
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.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
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.
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.

Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!

This topic is closed to new replies.

Advertisement