RECTXRECT(3R)

NAME
rectxrect: rectXrect - check for overlapping Rectangles

SYNOPSIS
#include <dmd.h>

int rectXrect (r, s)
Rectangle r, s;

DESCRIPTION
The rectXrect function returns 1 if r and s share any point; 0, otherwise.

EXAMPLE
The following routine will prompt the user to sweep out two Rectangles with button 1. If they intersect, the bell will ring. Typing any key will exit the program.

        #include <dmd.h>
        int request();
        int wait();
        void box();
        void ringbell();
        Rectangle newrect();
        main()
        {
    	Rectangle r, s;
    	request (MOUSE|KBD);
    	while (kbdchar () == -1) {
    	    wait (MOUSE);
    	    r = newrect (1, Rect(0,0,0,0));
    	    box (&display, r, F_XOR);
    	    s = newrect (1, Rect(0,0,0,0));
    	    box (&display, s, F_XOR);
    	    if (rectXrect (r, s))
    		 ringbell ();
    	    box (&display, r, F_XOR);
    	    box (&display, s, F_XOR);
    	    wait (MOUSE | KBD);
    	}
        }

SEE ALSO
structures(3R).