Below is a little graph with an example.

I have 2 quadrangles and I know every point location of both of them.

Now I'd need a calculation that lets me check if they overlap or not.

The quadrangles are always convex.

I came as far as this:

if the minimum x value of quad2 is higher than the maximum x value of quad1 or the maximum x value of quad2 is smaller than the minimum x value of quad1, they can never overlap

if the minimum y value of quad2 is higher than the maximum y value of quad1 or the maximum y value of quad2 is smaller than the minimum y value of quad1, they can never overlap

but that's not enough, the blue quadrangle passes these 2 criteria and yet it doesn't overlap with the black one.

Anyone got an idea?

Thanks in advance.

mathproblem.jpg