This is for a web app, but I think it's a general geometric problem, and almost certainly a solved one:
I have a rectangle $(A)$ and I know its size. I'm trying to figure out if there's another rectangle $(B)$ overlapping mine, and by how much to $25\%$ accuracy. (That is, I want to know if $B$ is covering $0\%$, $0-25\%$, $25-50\%$, $50-75\%$ or $100\%$ of $A$.)
- There may or may not be a second rectangle.
- There may be more than one other rectangle.
- The rectangles are all oriented parallel to each other (no rotation).
- I can only test by checking for an overlap at a particular point on my rectangle's surface.
I'm trying to figure out the most efficient possible arrangement of detection points. Ideally, I'd simply be able to count up the number of hits to know the $\%$ in some kind of simple linear way. Something like the image in this overlap detection drawing.
$\hskip{2.8in}$