home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Coord / c / RectsOvlap < prev    next >
Encoding:
Text File  |  1992-03-22  |  1.1 KB  |  32 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Coord.RectsOvlap.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (22 Mar 1992)
  14.     Purpose: Check if two rectangles overlap (rects intersect, or one rect
  15.              entirely contained by the other)
  16. */
  17.  
  18.  
  19. #include "Core.h"
  20. #include "Wimp.h"
  21.  
  22.  
  23. extern BOOL Coord_RectsOverlap(wimp_rect *rect1, wimp_rect *rect2)
  24. {
  25.   if (rect1->min.y > rect2->max.y)  return(FALSE);
  26.   if (rect1->max.y < rect2->min.y)  return(FALSE);
  27.  
  28.   if (rect1->min.x > rect2->max.x)  return(FALSE);
  29.   if (rect1->max.x < rect2->min.x)  return(FALSE);
  30.   return(TRUE);
  31. }
  32.