Newbie: Check overlapping squares

Newbie: Check overlapping squares

Post by Prim » Sat, 12 May 2001 16:34:30



Hi,

I want want to check if several given squares do not overlap. These squares
are given as xmin, xmax, ymin and ymax. The sqaures can be of different
size, but form an even larger square.

(view widt a unscalable font)
^   +-------------+-----+--------------+
|   |             |     |              |
Y   +---------+---+-----+----+---------+
    |         |              |         |
    +---------+              +---------+
    |         |              |         |
    +-----+---+------+-------+         |
    |     |          |       |         |
    +-----+----------+       |         |
    |     |          |       |         |
    +-----+----------+-------+---------+

                                    X ->

Any suggestions what algorithm I could use?

 
 
 

1. Overlapping Squares

What ideas does anybody have for an algorithm for overlapping rectangles?

Lets look at the GUI of any operating system, there are many overlapping
windows. They should be drawn back to front in order so that the "top"
window actually appears on top, and the bottom window is less visable.

So what would be a good algoritm to figure out "how much of this window
should I draw".  So that duplication of areas never occures, and double
writes to screen pixels never happens.

The problem for me is, how do you cut a rectangle by another rectangle?

My next problem is, how do you cut a polygon by another polygon.  

Are there any articles I should be looking at?

John McCarthy
--
John McCarthy - Author of that awesome Outer Ridge thing

2. AD: Ultra-Sharpen 7.0 Pro Now Available! - This is a one time posting

3. checking whether 2 2D polygons overlap

4. Plugins not found

5. Checking rectangle overlap in a plane

6. Motion Blur parameters?

7. BMRT support for SPARC

8. --Polygon overlap checking--

9. 2D Polygon Overlap Checking using OpenGL?

10. Newbie: Efficient overlapping windows

11. Newbie: Colors overlapping