]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/polygon/doc/gtl_rectangle_concept.htm
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / polygon / doc / gtl_rectangle_concept.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
3 xmlns:v="urn:schemas-microsoft-com:vml"
4 xmlns:o="urn:schemas-microsoft-com:office:office"
5 xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en">
6 <head>
7 <!--
8 Copyright 2009-2010 Intel Corporation
9 license banner
10 -->
11 <title>Boost Polygon Library: Rectangle Concept</title>
12 <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
13 <!-- <link type="text/css" rel="stylesheet" href="adobe_source.css"> -->
14 </head>
15 <body>
16 <table style="margin: 0pt; padding: 0pt; width: 100%;" border="0"
17 cellpadding="0" cellspacing="0">
18 <tbody>
19 <tr>
20 <td style="background-color: rgb(238, 238, 238);" nowrap="1"
21 valign="top">
22 <div style="padding: 5px;" align="center"> <img
23 src="images/boost.png" border="0" height="86" width="277" /><a
24 title="www.boost.org home page" href="http://www.boost.org/"
25 tabindex="2" style="border: medium none ;"> </a> </div>
26 <div style="margin: 5px;">
27 <h3 class="navbar">Contents</h3>
28 <ul>
29 <li><a href="index.htm">Boost.Polygon Main Page</a></li>
30 <li><a href="gtl_design_overview.htm">Design Overview</a></li>
31 <li><a href="gtl_isotropy.htm">Isotropy</a></li>
32 <li><a href="gtl_coordinate_concept.htm">Coordinate Concept</a></li>
33 <li><a href="gtl_interval_concept.htm">Interval Concept</a></li>
34 <li><a href="gtl_point_concept.htm">Point Concept</a></li>
35 <li><a href="gtl_segment_concept.htm">Segment Concept</a></li>
36 <li>Rectangle Concept</li>
37 <li><a href="gtl_polygon_90_concept.htm">Polygon 90 Concept</a></li>
38 <li><a href="gtl_polygon_90_with_holes_concept.htm">Polygon 90
39 With Holes Concept</a></li>
40 <li><a href="gtl_polygon_45_concept.htm">Polygon 45 Concept</a></li>
41 <li><a href="gtl_polygon_45_with_holes_concept.htm">Polygon 45
42 With Holes Concept</a></li>
43 <li><a href="gtl_polygon_concept.htm">Polygon Concept</a></li>
44 <li><a href="gtl_polygon_with_holes_concept.htm">Polygon With
45 Holes Concept</a></li>
46 <li><a href="gtl_polygon_90_set_concept.htm">Polygon 90 Set
47 Concept</a></li>
48 <li><a href="gtl_polygon_45_set_concept.htm">Polygon 45 Set
49 Concept</a></li>
50 <li><a href="gtl_polygon_set_concept.htm">Polygon Set Concept</a></li>
51 <li><a href="gtl_connectivity_extraction_90.htm">Connectivity
52 Extraction 90</a></li>
53 <li><a href="gtl_connectivity_extraction_45.htm">Connectivity
54 Extraction 45</a></li>
55 <li><a href="gtl_connectivity_extraction.htm">Connectivity
56 Extraction</a></li>
57 <li><a href="gtl_property_merge_90.htm">Property Merge 90</a></li>
58 <li><a href="gtl_property_merge_45.htm">Property Merge 45</a></li>
59 <li><a href="gtl_property_merge.htm">Property Merge</a></li>
60 <li><a href="voronoi_main.htm">Voronoi Main Page<br />
61 </a></li>
62 <li><a href="voronoi_benchmark.htm">Voronoi Benchmark</a><br />
63 </li>
64 <li><a href="voronoi_builder.htm">Voronoi Builder</a></li>
65 <li><a href="voronoi_diagram.htm">Voronoi Diagram</a></li>
66 </ul>
67 <h3 class="navbar">Other Resources</h3>
68 <ul>
69 <li><a href="GTL_boostcon2009.pdf">GTL Boostcon 2009 Paper</a></li>
70 <li><a href="GTL_boostcon_draft03.pdf">GTL Boostcon 2009
71 Presentation</a></li>
72 <li><a href="analysis.htm">Performance Analysis</a></li>
73 <li><a href="gtl_tutorial.htm">Layout Versus Schematic Tutorial</a></li>
74 <li><a href="gtl_minkowski_tutorial.htm">Minkowski Sum Tutorial</a></li>
75 <li><a href="voronoi_basic_tutorial.htm">Voronoi Basic Tutorial</a></li>
76 <li><a href="voronoi_advanced_tutorial.htm">Voronoi Advanced
77 Tutorial</a></li>
78 </ul>
79 </div>
80 <h3 class="navbar">Polygon Sponsor</h3>
81 <div style="padding: 5px;" align="center"> <img
82 src="images/intlogo.gif" border="0" height="51" width="127" /><a
83 title="www.adobe.com home page" href="http://www.adobe.com/"
84 tabindex="2" style="border: medium none ;"> </a> </div>
85 </td>
86 <td
87 style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
88 valign="top" width="100%">
89 <!-- End Header --><br />
90 <p>
91 </p>
92 <h1>Rectangle Concept</h1>
93 <p> </p>
94 <p>The rectangle concept tag is <font face="Courier New">
95 rectangle_concept</font></p>
96 <p> To register a user defined type as a model of <font
97 face="Times New Roman">rectangle </font>concept, specialize the
98 geometry concept meta-function for that type.&nbsp; In the example
99 below CRectangle is registered as a model of rectangle&nbsp; concept.</p>
100 <p> <font face="Courier New">template &lt;&gt;<br />
101 struct geometry_concept&lt;CRectangle&gt; { typedef rectangle_concept
102 type; };</font></p>
103 <p> <font face="Times New Roman">The semantic of a rectangle is
104 that it has an x and a y interval and these intervals conform to the
105 semantic of an interval including its invariant.&nbsp; This invariant
106 on the intervals of a rectangle is enforced by the generic library
107 functions that operate on rectangles, and is not expected of the data
108 type itself or the concept mapping of that data type to the rectangle
109 concept through its traits.&nbsp; In this way a boost::tuple&lt;int,
110 int, int, int&gt; or boost::array&lt;int, 4&gt; could be made models of
111 rectangle by simply providing indirect access to their elements through
112 traits.</font></p>
113 <p> <font face="Times New Roman">Below is shown the default
114 rectangle traits.&nbsp; Specialization of these traits is required for
115 types that don't conform to the default behavior.&nbsp; The interested
116 reader will note SFINAE is used on the traits to allow only an object
117 that provides a member type definition of interval_type to work with
118 the default read only traits.&nbsp; This becomes necessary when
119 refinements of concepts are used and it is undesirable to attempt to
120 match default traits to non-rectangle types at compile time.&nbsp;
121 Specializing rectangle_traits can be done easily by simply providing
122 gtl_yes as the enable parameter.</font></p>
123 <p> <font face="Courier New">template &lt;typename T, typename
124 enable = gtl_yes&gt;<br />
125 struct rectangle_traits {};</font></p>
126 <p> <font face="Courier New">template &lt;typename T&gt;<br />
127 struct rectangle_traits&lt;T, gtl_no&gt; {};<br />
128 <br />
129 template &lt;typename T&gt;<br />
130 struct rectangle_traits&lt;T, typename gtl_same_type&lt;typename
131 T::interval_type, typename T::interval_type&gt;::type&gt; {<br />
132 &nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::coordinate_type
133 coordinate_type;<br />
134 &nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::interval_type
135 interval_type;<br />
136 &nbsp;&nbsp;&nbsp;&nbsp; static inline interval_type get(const T&amp;
137 rectangle, orientation_2d orient) {<br />
138 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
139 rectangle.get(orient); }<br />
140 };<br />
141 <br />
142 template &lt;typename T&gt;<br />
143 struct rectangle_mutable_traits {<br />
144 &nbsp;&nbsp;&nbsp;&nbsp; template &lt;typename T2&gt;<br />
145 &nbsp;&nbsp;&nbsp;&nbsp; static inline void set(T&amp; rectangle,
146 orientation_2d orient, const T2&amp; interval) {<br />
147 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
148 rectangle.set(orient, interval); }<br />
149 &nbsp;&nbsp;&nbsp;&nbsp; template &lt;typename T2, typename T3&gt;<br />
150 &nbsp;&nbsp;&nbsp;&nbsp; static inline T construct(const T2&amp;
151 interval_horizontal, const T3&amp; interval_vertical) {<br />
152 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
153 T(interval_horizontal, interval_vertical); }<br />
154 };</font></p>
155 <h2>Functions</h2>
156 <table id="table1" border="1" width="100%">
157 <tbody>
158 <tr>
159 <td width="586"><font face="Courier New">template
160 &lt;typename T&gt;<br />
161 interval_type <b>get</b>(const T&amp; rectangle, orientation_2d)</font></td>
162 <td><font face="Times New Roman">Expects a model of
163 rectangle.&nbsp; Returns the x interval or y interval of the rectangle,
164 depending on the orientation_2d value.</font><font face="Courier New"><br />
165 &nbsp;</font></td>
166 </tr>
167 <tr>
168 <td width="586"><font face="Courier New">template
169 &lt;typename T, typename coordinate_type&gt;<br />
170 void <b>set</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
171 <td><font face="Times New Roman">Expects a model of
172 rectangle.&nbsp;&nbsp; Sets the x interval or y interval of the
173 rectangle to the coordinate, depending on the orientation_2d value.</font></td>
174 </tr>
175 <tr>
176 <td width="586"><font face="Courier New">template
177 &lt;typename T&gt;<br />
178 interval_type <b>get</b>(const T&amp; rectangle, orientation_2d, <br />
179 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
180 direction_1d)</font></td>
181 <td><font face="Times New Roman">Expects
182 a model of rectangle.&nbsp; Returns the coordinate specificed by the
183 direction_1d value of the x interval or y interval of the rectangle,
184 depending on the orientation_2d value.</font><font face="Courier New"><br />
185 &nbsp;</font></td>
186 </tr>
187 <tr>
188 <td width="586"><font face="Courier New">template
189 &lt;typename T, typename coordinate_type&gt;<br />
190 void <b>set</b>(T&amp; rectangle, orientation_2d, direction_1d, <br />
191 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_type)</font></td>
192 <td><font face="Times New Roman">Expects a model of
193 rectangle.&nbsp;&nbsp; Sets the coordinate specified by the
194 direction_1d value of the x interval or y interval of the rectangle to
195 the coordinate, depending on the orientation_2d value.</font></td>
196 </tr>
197 <tr>
198 <td width="586"><font face="Courier New">template
199 &lt;typename T, typename T2&gt;<br />
200 T <b>construct</b>(const T2&amp; h, const T2&amp; v)</font></td>
201 <td>Construct an object that is a model of rectangle given
202 x interval and y intervals.</td>
203 </tr>
204 <tr>
205 <td width="586"><font face="Courier New">template
206 &lt;typename T, typename T2&gt;<br />
207 T <b>construct</b>(coordinate_type xl, coordinate_type yl, <br />
208 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
209 coordinate_type xh, coordinate_type yh)</font></td>
210 <td>Construct an object that is a model of rectangle given
211 four coordinate values.</td>
212 </tr>
213 <tr>
214 <td width="586"><font face="Courier New">template
215 &lt;typename T1, typename T2&gt;<br />
216 T1&amp; <b>assign</b>(T1&amp; left, const T2&amp; right)</font></td>
217 <td>Copies data from right object that models rectangle
218 into left object that models rectangle.</td>
219 </tr>
220 <tr>
221 <td width="586"><font face="Courier New">template
222 &lt;typename T, typename T2&gt;<br />
223 bool <b>equivalence</b>(const T&amp; rectangle1, </font> <br />
224 <font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
225 const T2&amp; rectangle2)</font></td>
226 <td>Given two objects that model rectangle, compares and
227 returns true if their x and y intervals are respectively equivalent.</td>
228 </tr>
229 <tr>
230 <td width="586"><font face="Courier New">template
231 &lt;typename T, typename point_type&gt;<br />
232 bool <b>contains</b>(const T&amp;, const point_type&amp; point, <br />
233 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
234 bool consider_touch=true)</font></td>
235 <td>Given an object that models rectangle and an object
236 that models point, returns true if the rectangle contains the
237 point.&nbsp; If the consider_touch flag is true will return true if the
238 point lies along the boundary of the rectangle.</td>
239 </tr>
240 <tr>
241 <td width="586"><font face="Courier New">template
242 &lt;typename T1, typename T2&gt;<br />
243 bool <b>contains</b>(const T1&amp; a, const T2&amp; b, <br />
244 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
245 bool consider_touch = true) </font></td>
246 <td>Returns true if model of rectangle a contains both
247 intervals of model of rectangle b.&nbsp; If the consider_touch flag is
248 true will consider rectangle b contained even if it touches the
249 boundary of a.</td>
250 </tr>
251 <tr>
252 <td width="586"><font face="Courier New">template
253 &lt;typename T&gt;<br />
254 interval_type <b>horizontal</b>(const T&amp; rectangle)</font></td>
255 <td>Returns the x interval of an object that models
256 rectangle.</td>
257 </tr>
258 <tr>
259 <td width="586"><font face="Courier New">template
260 &lt;typename T&gt;<br />
261 interval_type <b>vertical</b>(const T&amp; rectangle)</font></td>
262 <td>Returns the y interval of an object that models
263 rectangle.</td>
264 </tr>
265 <tr>
266 <td width="586"><font face="Courier New">template
267 &lt;typename T&gt;<br />
268 coordinate_type <b>xl</b>(const T&amp; rectangle)</font></td>
269 <td>Returns the west coordinate of an object that models
270 rectangle.</td>
271 </tr>
272 <tr>
273 <td width="586"><font face="Courier New">template
274 &lt;typename T&gt;<br />
275 coordinate_type <b>xh</b>(const T&amp; rectangle)</font></td>
276 <td>Returns the east coordinate of an object that models
277 rectangle.</td>
278 </tr>
279 <tr>
280 <td width="586"><font face="Courier New">template
281 &lt;typename T&gt;<br />
282 coordinate_type <b>yl</b>(const T&amp; rectangle)</font></td>
283 <td>Returns the south coordinate of an object that models
284 rectangle.</td>
285 </tr>
286 <tr>
287 <td width="586"><font face="Courier New">template
288 &lt;typename T&gt;<br />
289 coordinate_type <b>yh</b>(const T&amp; rectangle)</font></td>
290 <td>Returns the north coordinate of an object that models
291 rectangle.</td>
292 </tr>
293 <tr>
294 <td width="586"><font face="Courier New">template
295 &lt;typename T&gt;<br />
296 point_type <b>ll</b>(const T&amp; rectangle)</font></td>
297 <td>Returns the lower left corner point of an object that
298 models rectangle.</td>
299 </tr>
300 <tr>
301 <td width="586"><font face="Courier New">template
302 &lt;typename T&gt;<br />
303 point_type <b>lr</b>(const T&amp; rectangle)</font></td>
304 <td>Returns the lower right corner point of an object that
305 models rectangle.</td>
306 </tr>
307 <tr>
308 <td width="586"><font face="Courier New">template
309 &lt;typename T&gt;<br />
310 point_type <b>ul</b>(const T&amp; rectangle)</font></td>
311 <td>Returns the upper left corner point of an object that
312 models rectangle.</td>
313 </tr>
314 <tr>
315 <td width="586"><font face="Courier New">template
316 &lt;typename T&gt;<br />
317 point_type <b>ur</b>(const T&amp; rectangle)</font></td>
318 <td>Returns the upper right corner point of an object that
319 models rectangle.</td>
320 </tr>
321 <tr>
322 <td width="586"><font face="Courier New">// get the center
323 coordinate<br />
324 template &lt;typename T, typename point_type&gt;<br />
325 void <b>center</b>(point_type&amp; p, const T&amp; rectangle)</font></td>
326 <td>Sets object that models point to the center point of an
327 object that models rectangle.</td>
328 </tr>
329 <tr>
330 <td width="586"><font face="Courier New">template
331 &lt;typename T, typename interval_type&gt;<br />
332 void <b>horizontal</b>(T&amp; rectangle, const interval_type&amp; i)</font></td>
333 <td>Sets the x interval of the object that models rectangle
334 to be equal to the value of an object that models interval.</td>
335 </tr>
336 <tr>
337 <td width="586"><font face="Courier New">template
338 &lt;typename T, typename interval_type&gt;<br />
339 void <b>vertical</b>(T&amp; rectangle, const interval_type&amp; i )</font></td>
340 <td>Sets the y interval of the object that models rectangle
341 to be equal to the value of an object that models interval.</td>
342 </tr>
343 <tr>
344 <td width="586"><font face="Courier New">template
345 &lt;typename rectangle_type&gt;<br />
346 void <b>xl</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
347 <td>Sets the west coordinate of the object that models
348 rectangle to be equal to the coordinate value.</td>
349 </tr>
350 <tr>
351 <td width="586"><font face="Courier New">template
352 &lt;typename rectangle_type&gt;<br />
353 void <b>xh</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
354 <td>Sets the east coordinate of the object that models
355 rectangle to be equal to the coordinate value.</td>
356 </tr>
357 <tr>
358 <td width="586"><font face="Courier New">template
359 &lt;typename rectangle_type&gt;<br />
360 void <b>yl</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
361 <td>Sets the south coordinate of the object that models
362 rectangle to be equal to the coordinate value.</td>
363 </tr>
364 <tr>
365 <td width="586"><font face="Courier New">template
366 &lt;typename rectangle_type&gt;<br />
367 void <b>yh</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
368 <td>Sets the north coordinate of the object that models
369 rectangle to be equal to the coordinate value.</td>
370 </tr>
371 <tr>
372 <td width="586"><font face="Courier New">template
373 &lt;typename T, typename T1, typename T2&gt;<br />
374 T&amp; <b>set_points</b>(T&amp; rectangle, const T1&amp; p1, const
375 T2&amp; p2)</font></td>
376 <td>Sets the rectangle to the rectangle fully described by
377 the points p1 and p2.</td>
378 </tr>
379 <tr>
380 <td width="586"><font face="Courier New">template
381 &lt;typename T&gt;<br />
382 coordinate_difference <b>delta</b>(const T&amp; rectangle, <br />
383 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
384 orientation_2d)</font></td>
385 <td>Returns the delta of the interval specified by
386 orientation_2d of an object that models rectangle.</td>
387 </tr>
388 <tr>
389 <td width="586"><font face="Courier New">template
390 &lt;typename T&gt;<br />
391 manhattan_area_type <b>area</b>(const T&amp; rectangle)</font></td>
392 <td>Returns the area of an object that models rectangle.</td>
393 </tr>
394 <tr>
395 <td width="586"><font face="Courier New">template
396 &lt;typename T&gt;<br />
397 coordinate_difference <b>half_perimeter</b>(const T&amp; rectangle)</font></td>
398 <td>Returns the length plus width of an object that models
399 rectangle.</td>
400 </tr>
401 <tr>
402 <td width="586"><font face="Courier New">template
403 &lt;typename T&gt;<br />
404 coordinate_difference <b>perimeter</b>(const T&amp; rectangle)</font></td>
405 <td>Returns the perimeter length of an object that models
406 rectangle.</td>
407 </tr>
408 <tr>
409 <td width="586"><font face="Courier New">template
410 &lt;typename T&gt;<br />
411 orientation_2d <b>quess_orientation</b>(const T&amp; rectangle)</font></td>
412 <td>Returns the orientation in which the rectangle has a
413 longer delta.&nbsp; Returns HORIZONTAL if the rectangle is a square.</td>
414 </tr>
415 <tr>
416 <td width="586"><font face="Courier New">template
417 &lt;typename rectangle_type&gt;<br />
418 rectangle_type&amp; <b>transform</b>(rectangle_type&amp; rectangle,<br />
419 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
420 coordinate_type axis = 0)</font></td>
421 <td>Applies transform() on the two points that fully
422 describe the rectangle and sets the rectangle to that described by the
423 result of transforming those points.</td>
424 </tr>
425 <tr>
426 <td width="586"><font face="Courier New">template
427 &lt;typename rectangle_type&gt;<br />
428 rectangle_type&amp; <b>scale_up</b>(rectangle_type&amp; rectangle, <br />
429 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
430 unsigned_area_type factor)</font></td>
431 <td>Scales up x interval and y interval&nbsp; of an object
432 that models rectangle by unsigned factor.</td>
433 </tr>
434 <tr>
435 <td width="586"><font face="Courier New">template
436 &lt;typename rectangle_type&gt;<br />
437 rectangle_type&amp; <b>scale_down</b>(rectangle_type&amp; rectangle, <br />
438 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
439 unsigned_area_type factor)</font></td>
440 <td>Scales down x interval and y interval&nbsp; of an
441 object that models rectangle by unsigned factor.</td>
442 </tr>
443 <tr>
444 <td width="586"><font face="Courier New">template
445 &lt;typename rectangle_type, scaling_type&gt;<br />
446 rectangle_type&amp; <b>scale</b>(rectangle_type&amp; rectangle,<br />
447 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
448 const scaling_type&amp; scaling) </font></td>
449 <td>Applies scale() on the two points that fully describe
450 the rectangle and sets the rectangle to that described by the result of
451 transforming those points.</td>
452 </tr>
453 <tr>
454 <td width="586"><font face="Courier New">template
455 &lt;typename T&gt;<br />
456 T&amp; <b>move</b>(T&amp; rectangle, orientation_2d,<br />
457 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_difference
458 displacement)</font></td>
459 <td>Adds displacement value to interval indicated by
460 orientation_2d of an object that models rectangle.</td>
461 </tr>
462 <tr>
463 <td width="586"><font face="Courier New">template
464 &lt;typename rectangle_type, typename point_type&gt;<br />
465 rectangle_type&amp; <b>convolve</b>(rectangle_type&amp; rectangle,<br />
466 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
467 const point_type&amp; point)</font></td>
468 <td>Convolves coordinate values of point with x interval
469 and y interval&nbsp; of an object that models rectangle.</td>
470 </tr>
471 <tr>
472 <td width="586"><font face="Courier New">template
473 &lt;typename rectangle_type, typename point_type&gt;<br />
474 rectangle_type&amp; <b>deconvolve</b>(rectangle_type&amp; rectangle,<br />
475 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
476 const point_type&amp; point)</font></td>
477 <td>Deconvolves coordinate values of point withx interval
478 and y interval&nbsp; of an object that models rectangle.</td>
479 </tr>
480 <tr>
481 <td width="586"><font face="Courier New">template
482 &lt;typename T1, typename T2&gt;<br />
483 T1&amp; <b>convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
484 <td>Convolves x interval&nbsp; of b with x interval&nbsp;
485 of a and convolves y interval&nbsp; of b with y interval&nbsp; of a.</td>
486 </tr>
487 <tr>
488 <td width="586"><font face="Courier New">template
489 &lt;typename T1, typename T2&gt;<br />
490 T1&amp; <b>deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
491 <td>Deconvolves x interval&nbsp; of b with x interval&nbsp;
492 of a and deconvolves y interval&nbsp; of b with y interval&nbsp; of a. </td>
493 </tr>
494 <tr>
495 <td width="586"><font face="Courier New">template
496 &lt;typename T1, typename T2&gt;<br />
497 T1&amp; <b>reflected_convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
498 <td>Reflected convolves y interval&nbsp; of b with x
499 interval&nbsp; of a and reflected convolves x interval&nbsp; of b with
500 y interval&nbsp; of a.</td>
501 </tr>
502 <tr>
503 <td width="586"><font face="Courier New">template
504 &lt;typename T1, typename T2&gt;<br />
505 T1&amp; <b>reflected_deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
506 <td>Reflected deconvolves y interval&nbsp; of b with x
507 interval&nbsp; of a and reflected deconvolves x interval&nbsp; of b
508 with y interval&nbsp; of a.</td>
509 </tr>
510 <tr>
511 <td width="586"><font face="Courier New">template
512 &lt;typename T, typename point_type&gt;<br />
513 coordinate_difference <b>euclidean_distance</b>(const T&amp;,<br />
514 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point,
515 orienation_2d)</font></td>
516 <td>Returns the distance from an object that models
517 rectangle to an object that models point along the given
518 orientation.&nbsp; Returns zero if the point is contained within the
519 rectangle along that orientation.</td>
520 </tr>
521 <tr>
522 <td width="586"><font face="Courier New">template
523 &lt;typename T1, typename T2&gt;<br />
524 coordinate_difference <b>euclidean_distance</b>(const T1&amp; a,<br />
525 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const T2&amp; b, orienation_2d)</font></td>
526 <td>Returns the distance from an object that models
527 rectangle to an object that models rectangle along the given
528 orientation.&nbsp; Returns zero if the intervals of the rectangles
529 overlap along that orientation.</td>
530 </tr>
531 <tr>
532 <td width="586"><font face="Courier New">template
533 &lt;typename T, typename point_type&gt;<br />
534 coordinate_difference <b>square_euclidean_distance</b>(const T&amp;,<br />
535 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
536 <td>Returns the square of the Euclidean distance between a
537 point and a rectangle.&nbsp; Returns zero if the point is contained
538 within the rectangle.</td>
539 </tr>
540 <tr>
541 <td width="586"><font face="Courier New">template
542 &lt;typename T1, typename T2&gt;<br />
543 coordinate_difference <b>square_euclidean_distance</b><br />
544 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (const T1&amp; a, const T2&amp; b)</font></td>
545 <td>Returns the square of the Euclidean distance between
546 rectangles a and b.&nbsp; Returns zero if the rectangles intersect.</td>
547 </tr>
548 <tr>
549 <td width="586"><font face="Courier New">template
550 &lt;typename T, typename point_type&gt;<br />
551 coordinate_difference <b>manhattan_distance</b>(const T&amp;,<br />
552 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
553 <td>Returns the Manhattan distance between a point and a
554 rectangle.&nbsp; Returns zero if the point is contained within the
555 rectangle.</td>
556 </tr>
557 <tr>
558 <td width="586"><font face="Courier New">template
559 &lt;typename T1, typename T2&gt;<br />
560 coordinate_difference <b>manhattan_distance</b>(const T1&amp; a, <br />
561 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
562 const T2&amp; b)</font></td>
563 <td>Returns the Manhattan distance between rectangles a and
564 b.&nbsp; Returns zero if the rectangles intersect.</td>
565 </tr>
566 <tr>
567 <td width="586"><font face="Courier New">template
568 &lt;typename T, typename point_type&gt;<br />
569 coordinate_distance <b>euclidean_distance</b>(const T&amp;,<br />
570 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
571 <td>Returns the Euclidean distance between a point and a
572 rectangle.&nbsp; Returns zero if the point is contained within the
573 rectangle.</td>
574 </tr>
575 <tr>
576 <td width="586"><font face="Courier New">template
577 &lt;typename T1, typename T2&gt;<br />
578 coordinate_distance <b>euclidean_distance</b>(const T1&amp; a, <br />
579 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
580 const T2&amp; b)</font></td>
581 <td>Returns the Euclidean distance between rectangles a and
582 b.&nbsp; Returns zero if the rectangles intersect.</td>
583 </tr>
584 <tr>
585 <td width="586"><font face="Courier New">template
586 &lt;typename T1, typename T2&gt;<br />
587 bool <b>intersects</b>(const T1&amp; a, const T2&amp; b, <br />
588 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
589 bool consider_touch = true)</font></td>
590 <td>Returns true if two objects that model rectangle
591 overlap.&nbsp; If the consider_touch flag is true touching at the sides
592 or corners is considered overlap.</td>
593 </tr>
594 <tr>
595 <td width="586"><font face="Courier New">template
596 &lt;typename T1, typename T2&gt;<br />
597 bool <b>boundaries_intersect</b>(const T1&amp; a, const T2&amp; b, <br />
598 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
599 bool consider_touch = true)</font></td>
600 <td>Returns true is two objects that model rectangle
601 partially overlap such that one there is an intersection between the
602 edges of the two rectangles&nbsp; If the consider_touch flag is true a
603 coordinate is considered contained even if the two rectangles touch
604 only along a side or corner.</td>
605 </tr>
606 <tr>
607 <td width="586"><font face="Courier New">template
608 &lt;typename T1, typename T2&gt;<br />
609 bool <b>abuts</b>(const T1&amp; a, const T2&amp; b,<br />
610 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
611 direction_2d dir) </font></td>
612 <td>Returns true if rectangle b abuts but down not overlap
613 rectangle a on the side of rectangle a specified by dir.</td>
614 </tr>
615 <tr>
616 <td width="586"><font face="Courier New">template
617 &lt;typename T1, typename T2&gt;<br />
618 bool <b>abuts</b>(const T1&amp; a, const T2&amp; b,<br />
619 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
620 orientation_2d) </font></td>
621 <td>Returns true if rectangle b abuts but down not overlap
622 rectangle a on either side of rectangle a specified by the
623 orientation_2d.</td>
624 </tr>
625 <tr>
626 <td width="586"><font face="Courier New">template
627 &lt;typename T1, typename T2&gt;<br />
628 bool <b>abuts</b>(const T1&amp; a, const T2&amp; b)</font></td>
629 <td>Returns true if rectangle b abuts but down not overlap
630 rectangle a on any side.</td>
631 </tr>
632 <tr>
633 <td width="586"><font face="Courier New">template
634 &lt;typename T1, typename T2&gt;<br />
635 bool <b>intersect</b>(T1&amp; a, const T2&amp; b, orientation_2d<br />
636 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
637 bool consider_touch = true) </font></td>
638 <td>Sets rectangle a to the intersection of rectangle a and
639 interval b along the orientation_2d and returns true.&nbsp; If the does
640 not intersect the interval, the rectangle is unchanged and the function
641 returns false.&nbsp; If the flag consider_touch is true intervals that
642 abut are considered to intersect.</td>
643 </tr>
644 <tr>
645 <td width="586"><font face="Courier New">template
646 &lt;typename T1, typename T2&gt;<br />
647 bool <b>intersect</b>(T1&amp; a, const T2&amp; b,<br />
648 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
649 bool consider_touch = true) </font></td>
650 <td>Sets rectangle a to the intersection of rectangle a and
651 rectangle b and return true.&nbsp; If the two rectangles do not
652 intersect rectangle a is unchanged and the function returns
653 false.&nbsp; If the flag consider_touch is true rectangles that abut
654 are considered to intersect.</td>
655 </tr>
656 <tr>
657 <td width="586"><font face="Courier New">template
658 &lt;typename T1, typename T2&gt;<br />
659 T&amp; <b>generalized_intersect</b>(T1&amp; a, const T2&amp; b)</font></td>
660 <td>Same as intersect, but if they do not intersect set a
661 to the rectangle between a and b by applying generalized_intersect() on
662 the intervals of the rectangles.</td>
663 </tr>
664 <tr>
665 <td width="586"><font face="Courier New">template
666 &lt;typename T&gt;<br />
667 T&amp; <b>bloat</b>(T&amp; rectangle, coordinate_type)</font></td>
668 <td>Bloats x and y intervals of rectangle by coordinate
669 value.</td>
670 </tr>
671 <tr>
672 <td width="586"><font face="Courier New">template
673 &lt;typename T&gt;<br />
674 T&amp; <b>bloat</b>(T&amp; rectangle, direction_2d, coordinate_type)</font></td>
675 <td>Bloats side of rectangle specified by direction_2d by
676 coordinate value.</td>
677 </tr>
678 <tr>
679 <td width="586"><font face="Courier New">template
680 &lt;typename T&gt;<br />
681 T&amp; <b>bloat</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
682 <td>Bloats interval of rectangle specified by
683 orientation_2d by coordinate value.</td>
684 </tr>
685 <tr>
686 <td width="586"><font face="Courier New">template
687 &lt;typename T&gt;<br />
688 T&amp; <b>shrink</b>(T&amp; rectangle, coordinate_type)</font></td>
689 <td>Shrinks x and y intervals of rectangle by coordinate
690 value.</td>
691 </tr>
692 <tr>
693 <td width="586"><font face="Courier New">template
694 &lt;typename T&gt;<br />
695 T&amp; <b>shrink</b>(T&amp; rectangle, direction_2d, coordinate_type)</font></td>
696 <td>Shrinks side of rectangle specified by direction_2d by
697 coordinate value.</td>
698 </tr>
699 <tr>
700 <td width="586"><font face="Courier New">template
701 &lt;typename T&gt;<br />
702 T&amp; <b>shrink</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
703 <td>Shrinks interval of rectangle specified by
704 orientation_2d by coordinate value.</td>
705 </tr>
706 <tr>
707 <td width="586"><font face="Courier New">template
708 &lt;typename T1, typename T2&gt;<br />
709 bool <b>encompass</b>(T1&amp; a, const T2&amp; b)</font></td>
710 <td>The x and y intervals of a are set to encompass the x
711 and y intervals of b respectively.</td>
712 </tr>
713 <tr>
714 <td width="586"><font face="Courier New">template
715 &lt;typename T, typename point_type&gt;<br />
716 bool <b>encompass</b>(T&amp; rectangle, const point_type&amp; point)</font></td>
717 <td>The x and y intervals of rectangle are set to encompass
718 the x and y coordinates of point respectively.</td>
719 </tr>
720 <tr>
721 <td width="586"><font face="Courier New">template
722 &lt;typename T, typename interval_type&gt;<br />
723 bool <b>encompass</b>(T&amp; rectangle, const interval_type&amp; i, <br />
724 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
725 orientation_2d)</font></td>
726 <td>The interval of rectangle specified by orientation_2d
727 is set to encompass the interval i.</td>
728 </tr>
729 <tr>
730 <td width="586"><font face="Courier New">template
731 &lt;typename T, typename point_type&gt;<br />
732 bool <b>get_corner</b>(point_type&amp; point, const T&amp;
733 rectangle,&nbsp; <br />
734 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
735 direction_2d, direction_1d)</font></td>
736 <td>Sets point to the corner of the rectangle you reach if
737 you look at its side specified by direction_2d from within the
738 rectangle and turn in the direction_1d direction (low == left, high =
739 right).&nbsp; Always returns true.</td>
740 </tr>
741 </tbody>
742 </table>
743 <h1>Rectangle Data</h1>
744 <p> </p>
745 <p>The library provides a model of rectangle concept declared
746 <font face="Courier New">template&lt;typename T&gt;
747 rectangle_data </font>where T is the coordinate type.</p>
748 <p>This data type is used internally when a rectangle is needed
749 and is available to the library user who finds it convenient to use a
750 library rectangle data type instead of providing their own.&nbsp; The
751 data type is implemented to be convenient to use with the library
752 traits.</p>
753 <h2>Members</h2>
754 <table id="table2" border="1" width="100%">
755 <tbody>
756 <tr>
757 <td width="586"><b><font face="Courier New">geometry_type</font></b></td>
758 <td><font face="Times New Roman">rectangle_concept</font></td>
759 </tr>
760 <tr>
761 <td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
762 <td><font face="Times New Roman">T</font></td>
763 </tr>
764 <tr>
765 <td width="586"><font face="Courier New"><b>interval_type</b></font></td>
766 <td><font face="Times New Roman">interval_data&lt;T&gt;</font></td>
767 </tr>
768 <tr>
769 <td width="586"><font face="Courier New"><b>rectangle_data</b>(T
770 xl, T yl, T xh, T yh)</font></td>
771 <td><font face="Times New Roman">Constructs a rectangle
772 with four coordinates.</font></td>
773 </tr>
774 <tr>
775 <td width="586"><font face="Courier New">template
776 &lt;typename T1, typename T2&gt;<b><br />
777 rectangle_data</b>(const T1&amp; horizontal_interval,<br />
778 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
779 const T2&amp; vertical_interval)</font></td>
780 <td><font face="Times New Roman">Constructs a rectangle
781 with two objects that model interval.</font></td>
782 </tr>
783 <tr>
784 <td width="586"><font face="Courier New"><b>rectangle_data</b>(const
785 rectangle_data&amp; that)</font></td>
786 <td><font face="Times New Roman">Copy construct</font></td>
787 </tr>
788 <tr>
789 <td width="586"><font face="Courier New">rectangle_data&amp;
790 <b>operator=</b>(const rectangle_data&amp; that)</font></td>
791 <td>Assignment operator.</td>
792 </tr>
793 <tr>
794 <td width="586"><font face="Courier New">template
795 &lt;typename T2&gt;<b> <br />
796 </b>rectangle_data&amp; <b> operator=</b>(const T2&amp;
797 that) const</font></td>
798 <td>Assign from an object that is a model of rectangle.</td>
799 </tr>
800 <tr>
801 <td width="586"><font face="Courier New">template
802 &lt;typename T2&gt;<b> <br />
803 </b>bool<b> operator==</b>(const T2&amp; that) const</font></td>
804 <td>Compare equality to an object that is a model of
805 rectangle.</td>
806 </tr>
807 <tr>
808 <td width="586"><font face="Courier New">template
809 &lt;typename T2&gt;<b> <br />
810 </b>bool<b> operator!=</b>(const T2&amp; that) const</font></td>
811 <td>Compare inequality to an object that is a model of
812 rectangle.</td>
813 </tr>
814 <tr>
815 <td width="586"><font face="Courier New">interval_data&lt;T&gt;
816 <b>get</b>(orientation_2d orient) const</font></td>
817 <td>Get the interval in the given orientation.</td>
818 </tr>
819 <tr>
820 <td width="586"><font face="Courier New">template
821 &lt;typename T2&gt;<br />
822 void <b>set</b>(orientation_2d orient, const T2&amp; value)</font></td>
823 <td>Sets the interval in the given orientation to the value
824 of an object that models interval.</td>
825 </tr>
826 </tbody>
827 </table>
828 </td>
829 </tr>
830 <tr>
831 <td style="background-color: rgb(238, 238, 238);" nowrap="1"
832 valign="top"> &nbsp;</td>
833 <td
834 style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
835 valign="top" width="100%">
836 <table class="docinfo" id="table8" frame="void" rules="none">
837 <colgroup> <col class="docinfo-name" /><col
838 class="docinfo-content" /> </colgroup> <tbody valign="top">
839 <tr>
840 <th class="docinfo-name">Copyright:</th>
841 <td>Copyright © Intel Corporation 2008-2010.</td>
842 </tr>
843 <tr class="field">
844 <th class="docinfo-name">License:</th>
845 <td class="field-body">Distributed under the Boost Software
846 License, Version 1.0. (See accompanying file <tt class="literal"> <span
847 class="pre">LICENSE_1_0.txt</span></tt> or copy at <a
848 class="reference" target="_top"
849 href="http://www.boost.org/LICENSE_1_0.txt">
850 http://www.boost.org/LICENSE_1_0.txt</a>)</td>
851 </tr>
852 </tbody>
853 </table>
854 </td>
855 </tr>
856 </tbody>
857 </table>
858 </body>
859 </html>