The second demo shows how the SAT algorithm works for testing the AABB detect collision of two quads.

From the previous demo, it is already known that each axis is a potential direction along which we can project the objects. So, all we need to do is find the axis with the smallest amount of overlap between the two objects.

the

**direction** of the projection vector “

**ARROW**” is the same as the axis direction which is the XY plane, and the

**length** of the projection vector is equal to the size of the overlap along that axis.

SFML implemented it efficiently on sf::Rect::intersects, check it here:

https://github.com/SFML/SFML/blob/master/include/SFML/Graphics/Rect.inl#L109Here the demo:

https://www.youtube.com/watch?v=h-JV1GLkLUk