Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

"The formula for intersection will be

SI= Max(0, Min(XA2, XB2) - Max(XA1, XB1)) * Max(0, Min(YA2, YB2) - Max(YA1, YB1))

then the union will be S=SA+SB-SI

And finally, the ratio will be SI / S."

found in this blog: https://stackoverflow.com/questions/9324339/how-much-do-two-rectangles-overlap