Mail Archives: djgpp/1997/10/01/00:14:12
Does anyone know how to detect if two rectangles overlap each other at
some point. Let's say we have something like this:
typedef struct RECT {
int x1, y1, x2, y2;
} RECT;
and I need a function that would take 2 of those and check if they
overlap. I got it working partailly by checking the corners of one
rectangle if they are inside the other, but if the other is smaller and is
completly enclosed in the first it does not work.
Any help would be appreciated.
Thanks.
,,,
(0 0)
+-------------oOO----(_)-------------------+
| Andrew Deren |
| aderen AT eecs DOT uic DOT edu |
| www.eecs.uic.edu/~aderen/ader/main.html |
+-------------------------oOO--------------+
|| ||
ooO Ooo
- Raw text -