Checking rectangle overlap in a plane

Checking rectangle overlap in a plane

Post by Afzal Ball » Fri, 23 Nov 1990 21:15:28



Hi,

    can anyone tell me a quick algorithm to check for overlap of
two rectangles that lie in the same plane and have the same orientation?
(Note: must allow for the possibility that one is totally included in
the other.)

Thanks

-Afzal Ballim

 
 
 

1. Checking rectangle overlap in a plane

If the sides are parallel to the axes, it's easy:  If the high X of one is less
then the low X of the other, or the high Y of one is less than the low Y of the
other, they DON'T overlap.  Otherwise, they do.  This can be determined in 4
comparisons:

        if ((hi_x1 < lo_x2) || (hi_x2 < lo_x1) ||
            (hi_y1 < lo_y2) || (hi_y2 < lo_y1))
          {
            They don't overlap
          }
        else
          {
            They do
          }

If the sides are not parallel to the principal axes, but they have the same
orientation (ie, the sides are parallel to each other), then it might be easiest
to just transform the coordinates so they are parallel to the X and Y axes.

2. STUNNING! 3D RENDERING'S / ANIMATIONS DONE in MAX!! NEWLY RE-DESIGNED!!

3. Overlapping rectangles -- HELP

4. without vertical distortion?

5. Overlap of Rectangles

6. Call for 3D Images

7. Moving rectangles to avoid overlapping

8. Beginner Question

9. Merging unit sqaures into non-overlapping rectangles

10. area of rectangles overlap algorithm needed

11. Polygon from overlapping Rectangles?

12. Rectangles overlapping

13. Overlapping rectangles