2D Polygon intersection testing

I have two polygons composed of a number of triangles each and I need to write code that will test if they are intersecting at any time.
Ill calculate an AABB (axis aligned bounding box) for each and test if they intersect first of all, but after that im not sure what to do.

I could test for each triangle against each other triangle but I'd like to know if there's a better method than this before programming it, because this function will be called several times per frame if a collision is likley.

If your polygons have a huge number of triangles, you might be able to space partition them. If they don't, I wouldn't worry about it and just test against every triangle. Calling a function "several times per frame" generally isn't a concern unless that function is astronomically slow... or if by "several" you mean "several thousand".

ThemsAllTook Wrote:If your polygons have a huge number of triangles, you might be able to space partition them. If they don't, I wouldn't worry about it and just test against every triangle. Calling a function "several times per frame" generally isn't a concern unless that function is astronomically slow... or if by "several" you mean "several thousand".

The reason I worry about using triangle/triangle checks is my code looks like this: