|
|
1.1 root 1: .ds ZZ DEVELOPMENT PACKAGE
2: .TH RECTXRECT 3R "630 MTG"
3: .XE "rectXrect()"
4: .SH NAME
5: rectxrect: rectXrect \- check for overlapping Rectangles
6: .SH SYNOPSIS
7: .ft B
8: #include <dmd.h>
9: .sp
10: int rectXrect (r, s)
11: .br
12: Rectangle r, s;
13: .SH DESCRIPTION
14: The
15: .I rectXrect
16: function
17: returns 1 if
18: .I r
19: and
20: .I s
21: share any point;
22: 0, otherwise.
23: .SH EXAMPLE
24: The following routine will prompt the user to sweep out two
25: Rectangles with button 1.
26: If they intersect, the bell will ring.
27: Typing any key will exit the program.
28: .PP
29: .RS 3
30: .nf
31: .ft CM
32: #include <dmd.h>
33:
34: int request();
35: int wait();
36: void box();
37: void ringbell();
38: Rectangle newrect();
39:
40: main()
41: {
42: Rectangle r, s;
43:
44: request (MOUSE|KBD);
45: while (kbdchar () == -1) {
46: wait (MOUSE);
47:
48: r = newrect (1, Rect(0,0,0,0));
49: box (&display, r, F_XOR);
50: s = newrect (1, Rect(0,0,0,0));
51: box (&display, s, F_XOR);
52: if (rectXrect (r, s))
53: ringbell ();
54: box (&display, r, F_XOR);
55: box (&display, s, F_XOR);
56:
57: wait (MOUSE | KBD);
58: }
59: }
60: \fR
61: .fi
62: .RE
63: .SH SEE ALSO
64: structures(3R).
65:
66: .RE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.