SAT: Separating Axis Theorem

BlitzMax Forums/BlitzMax Beginners Area/SAT: Separating Axis Theorem

Does anyone here care to explain to me how exactly you would use it. I'm looking for a very simple real world example.

How can I use it to calculate the overlap of two convex polys, which are made up of an array of x and y coords.

The only thing I've ever been able to understand is AABB collision. So I might be a lost cause. Boy, do I wish I had a brain sometimes.

I think you do it like so:

For every line in mesh A:
For every point in mesh B:
Find the plane that passes through these three points.

If every point in mesh A is on one side of this plane,
and every point in mesh B is on the other side of this plane,
then you have found a seperating plane, and the meshes are definitely not intersecting.

Next
Next

Then swap mesh A and B and do it again if you haven't found a seperating plane.


I'm pretty sure this only works for convex meshes. It won't work for concave meshes. You'd have to split the concave meshes into a bunch of convex meshes and test each seperately.


There's probably other methods which work for convex meshes, but are slower.

Ok that makes sense now, thank you. I'll have to try it and see what I get.