I am searching for an algorithm that will determine if a new rectangle is completely covered by a set of existing rectangles. Another way of putting the question, is does the ne
I have done something similar in the past. the idea was to compare the new rectangle with each of the existing (one by one)
if there is an intersection discard it (the intersected part), and add uncovered segments to a rectangle array
next, search for intersection between the new segments, and other existing (still unchecked) rectangles.
do the algorithm recursively discarding the intersections, and leaving only the uncovered parts.
in the end, if there is no rectangles in the array, you have a complete overlap
if there are still some rectangles in the array, the overlapping is not full as there are still some parts left.
hope this helps
I can try to find my code if this is what you are looking for. I think its in C#
another idea is to convert all existing rectangles into a polygon, and then check if new rectangle is inside the polygon, but I would not recommend this if you aren't using a language (or framework) which knows how to work with polygons.