# Non overlapping areas algorithm

One of my fellow members on stackoverflow has posted a question thread which concerns how to write a mathematical equation to calculate the exposed areas of a window from a group of windows (like on your desktop pc).

The thread in question can be found here...

http://stackoverflow.com/questions/15514202/remove-hidden-window-part/15514583#comment21994101_15514583

Now although i could write the program to do that in several lines of code where one step is covered step by step, I think it is beyond my scope to summarize it into a mathematical equation, so I thought to post it here in the Stack Exchange Mathematics Overflow.

I understand that the pseudo code has to be broken down and then applied in to the equation, but i came unstuck when i came to the looping portion of the pseudo code as i do not know how to transpose the loop into an equation.

-
Which format do you want the visible region to be output in? For example, it would probably be easier to provide it as a union of disjoint subrectangles than as a polygonal outline. – Henning Makholm Mar 20 '13 at 20:00
This is a CS question and should be at cs.stackexchange.com or cstheory.stackexchange.com . – user66652 Mar 20 '13 at 20:43
@clink31: The mathlike parts of CS are perfectly on-topic here. – Henning Makholm Mar 20 '13 at 23:35
@Henning Makholm, Yes I think disjointed rectangles is fine, as ultimately the end result may not be in contiguous block (like the first photo) rather it may be split (like the second photo). And as long as the equation works and gives the right results, how we come by the results is not as important UNLESS it means we are doing unnecessary calculations which can be avoided with forward planning. But i could not formulate the pseudo code into a mathematical equation. – Zaf Khan Mar 20 '13 at 23:58