Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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).

Example one of overlapping windows

Example two of overlapping windows

The thread in question can be found here...

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.

share|cite|improve this question
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 or . – 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.