home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnovrlap -- Report whether two rectangular regions
- * overlap.
- *
- * Synopsis result = wnovrlap(pcorner1,pdim1,pcorner2,pdim2);
- *
- * int result 1 if they overlap, 0 if not.
- * LOC *pcorner1,
- * *pcorner2 Pointers to structures designating
- * upper left corners of the two regions.
- * DIM *pdim1,
- * *pdim2 Pointers to structures designating
- * the dimensions of the two regions.
- *
- * Description This function compares two rectangular regions (assumed
- * to lie on the same display screen) and reports whether
- * they overlap.
- *
- * This function assumes that all its data is correct and
- * performs no data checking.
- *
- * Returns result 1 if they overlap, 0 if not.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bwindow.h>
-
- int wnovrlap(pcorner1,pdim1,pcorner2,pdim2)
- LOC *pcorner1;
- DIM *pdim1;
- LOC *pcorner2;
- DIM *pdim2;
- {
-
- #define bot_row1 (pcorner1->row + pdim1->h - 1)
- #define bot_row2 (pcorner2->row + pdim2->h - 1)
- #define rt_col1 (pcorner1->col + pdim1->w - 1)
- #define rt_col2 (pcorner2->col + pdim2->w - 1)
-
- return ( bot_row1 >= pcorner2->row
- && bot_row2 >= pcorner1->row
- && rt_col1 >= pcorner2->col
- && rt_col2 >= pcorner1->col);
- }