aboutsummaryrefslogtreecommitdiff
path: root/man/man3/addpt.html
blob: 1c327aaa6f37394bd57a8b43f02c8d0d1fb42f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<head>
<title>addpt(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>ADDPT(3)</b><td align=right><b>ADDPT(3)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    addpt, subpt, mulpt, divpt, rectaddpt, rectsubpt, insetrect, canonrect,
    eqpt, eqrect, ptinrect, rectinrect, rectXrect, rectclip, combinerect,
    Dx, Dy, Pt, Rect, Rpt &ndash; arithmetic on points and rectangles<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>#include &lt;u.h&gt;<br>
    #include &lt;libc.h&gt;<br>
    #include &lt;draw.h&gt; 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addpt(Point p, Point q) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subpt(Point p, Point q) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mulpt(Point p, int a) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;divpt(Point p, int a) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle rectaddpt(Rectangle r, Point p) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle rectsubpt(Rectangle r, Point p) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle insetrect(Rectangle r, int n) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle canonrect(Rectangle r) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eqpt(Point p, Point q) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eqrect(Rectangle r, Rectangle s) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptinrect(Point p, Rectangle r) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectinrect(Rectangle r, Rectangle s) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectXrect(Rectangle r, Rectangle s) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectclip(Rectangle *rp, Rectangle b) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>void  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;combinerect(Rectangle *rp, Rectangle b) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dx(Rectangle r) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>int  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dy(Rectangle r) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pt(int x, int y) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle Rect(int x0, int y0, int x1, int y1) 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    </font></tt>
    <tt><font size=+1>Rectangle Rpt(Point p, Point q)<br>
    </font></tt>
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    The functions <i>Pt</i>, <i>Rect</i> and <i>Rpt</i> construct geometrical data types
    from their components. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Addpt</i> returns the Point sum of its arguments: <tt><font size=+1>Pt(</font></tt><i>p</i><tt><font size=+1>.x+</font></tt><i>q</i><tt><font size=+1>.x,</font></tt> <i>p</i><tt><font size=+1>.y+</font></tt><i>q</i><tt><font size=+1>.y)</font></tt>.
    <i>Subpt</i> returns the Point difference of its arguments: <tt><font size=+1>Pt(</font></tt><i>p</i><tt><font size=+1>.x&#8722;</font></tt><i>q</i><tt><font size=+1>.x,</font></tt>
    <i>p</i><tt><font size=+1>.y&#8722;</font></tt><i>q</i><tt><font size=+1>.y)</font></tt>. <i>Mulpt</i> returns the Point <tt><font size=+1>Pt(</font></tt><i>p</i><tt><font size=+1>.x*</font></tt><i>a</i><tt><font size=+1>,</font></tt> <i>p</i><tt><font size=+1>.y*</font></tt><i>a</i><tt><font size=+1>)</font></tt>. <i>Divpt</i> returns
    the Point <tt><font size=+1>Pt(</font></tt><i>p</i><tt><font size=+1>.x/</font></tt><i>a</i><tt><font size=+1>,</font></tt> <i>p</i><tt><font size=+1>.y/</font></tt><i>a</i><tt><font size=+1>)</font></tt>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Rectaddpt</i> returns the Rectangle <tt><font size=+1>Rect(add(</font></tt><i>r</i><tt><font size=+1>.min,</font></tt> <i>p</i><tt><font size=+1>)</font></tt>, <tt><font size=+1>add(</font></tt><i>r</i><tt><font size=+1>.max,</font></tt>
    <i>p</i><tt><font size=+1>))</font></tt>; <i>rectsubpt</i> returns the Rectangle <tt><font size=+1>Rpt(sub(</font></tt><i>r</i><tt><font size=+1>.min,</font></tt> <i>p</i><tt><font size=+1>), sub(</font></tt><i>r</i><tt><font size=+1>.max,</font></tt>
    <i>p</i><tt><font size=+1>))</font></tt>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Insetrect</i> returns the Rectangle <tt><font size=+1>Rect(</font></tt><i>r</i><tt><font size=+1>.min.x+</font></tt><i>n</i>, <i>r</i><tt><font size=+1>.min.y+</font></tt><i>n</i>, <i>r</i><tt><font size=+1>.max.x&#8722;</font></tt><i>n</i>,
    <i>r</i><tt><font size=+1>.max.y&#8722;</font></tt><i>n</i><tt><font size=+1>)</font></tt>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Canonrect</i> returns a rectangle with the same extent as <i>r</i>, canonicalized
    so that <tt><font size=+1>min.x </font></tt>&le; <tt><font size=+1>max.x</font></tt>, and <tt><font size=+1>min.y </font></tt>&le; <tt><font size=+1>max.y</font></tt>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Eqpt</i> compares its argument Points and returns 0 if unequal, 1
    if equal. <i>Eqrect</i> does the same for its argument Rectangles. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Ptinrect</i> returns 1 if <i>p</i> is a point within <i>r</i>, and 0 otherwise.
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Rectinrect</i> returns 1 if all the pixels in <i>r</i> are also in <i>s</i>, and
    0 otherwise. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>RectXrect</i> returns 1 if <i>r</i> and <i>s</i> share any point, and 0 otherwise.
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Rectclip</i> clips in place the Rectangle pointed to by <i>rp</i> so that
    it is completely contained within <i>b</i>. The return value is 1 if
    any part of *<i>rp</i> is within <i>b</i>. Otherwise, the return value is 0
    and *<i>rp</i> is unchanged. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    <i>Combinerect</i> overwrites <tt><font size=+1>*rp</font></tt> with the smallest rectangle sufficient
    to cover all the pixels of <tt><font size=+1>*rp</font></tt> and <tt><font size=+1>b</font></tt>. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The functions <i>Dx</i> and <i>Dy</i> give the width (&#916;x) and height (&#916;y) of
    a Rectangle. They are implemented as macros.<br>
    
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/src/libdraw<br>
    </font></tt>
</table>
<p><font size=+1><b>SEE ALSO    </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <a href="../man3/graphics.html"><i>graphics</i>(3)</a><br>
    
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>