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">
8 Copyright 2009-2010 Intel Corporation
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"> -->
16 <table style=
"margin: 0pt; padding: 0pt; width: 100%;" border=
"0"
17 cellpadding=
"0" cellspacing=
"0">
20 <td style=
"background-color: rgb(238, 238, 238);" nowrap=
"1"
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>
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
48 <li><a href=
"gtl_polygon_45_set_concept.htm">Polygon
45 Set
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
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 />
62 <li><a href=
"voronoi_benchmark.htm">Voronoi Benchmark
</a><br />
64 <li><a href=
"voronoi_builder.htm">Voronoi Builder
</a></li>
65 <li><a href=
"voronoi_diagram.htm">Voronoi Diagram
</a></li>
67 <h3 class=
"navbar">Other Resources
</h3>
69 <li><a href=
"GTL_boostcon2009.pdf">GTL Boostcon
2009 Paper
</a></li>
70 <li><a href=
"GTL_boostcon_draft03.pdf">GTL Boostcon
2009
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
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>
87 style=
"padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
88 valign=
"top" width=
"100%">
89 <!-- End Header --><br />
92 <h1>Rectangle Concept
</h1>
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.
In the example
99 below CRectangle is registered as a model of rectangle
concept.
</p>
100 <p> <font face=
"Courier New">template
<><br />
101 struct geometry_concept
<CRectangle
> { typedef rectangle_concept
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.
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.
In this way a boost::tuple
<int,
110 int, int, int
> or boost::array
<int,
4> could be made models of
111 rectangle by simply providing indirect access to their elements through
113 <p> <font face=
"Times New Roman">Below is shown the default
114 rectangle traits.
Specialization of these traits is required for
115 types that don't conform to the default behavior.
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.
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.
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
<typename T, typename
124 enable = gtl_yes
><br />
125 struct rectangle_traits {};
</font></p>
126 <p> <font face=
"Courier New">template
<typename T
><br />
127 struct rectangle_traits
<T, gtl_no
> {};
<br />
129 template
<typename T
><br />
130 struct rectangle_traits
<T, typename gtl_same_type
<typename
131 T::interval_type, typename T::interval_type
>::type
> {
<br />
132 typedef typename T::coordinate_type
133 coordinate_type;
<br />
134 typedef typename T::interval_type
136 static inline interval_type get(const T
&
137 rectangle, orientation_2d orient) {
<br />
138 return
139 rectangle.get(orient); }
<br />
142 template
<typename T
><br />
143 struct rectangle_mutable_traits {
<br />
144 template
<typename T2
><br />
145 static inline void set(T
& rectangle,
146 orientation_2d orient, const T2
& interval) {
<br />
147
148 rectangle.set(orient, interval); }
<br />
149 template
<typename T2, typename T3
><br />
150 static inline T construct(const T2
&
151 interval_horizontal, const T3
& interval_vertical) {
<br />
152 return
153 T(interval_horizontal, interval_vertical); }
<br />
156 <table id=
"table1" border=
"1" width=
"100%">
159 <td width=
"586"><font face=
"Courier New">template
160 <typename T
><br />
161 interval_type
<b>get
</b>(const T
& rectangle, orientation_2d)
</font></td>
162 <td><font face=
"Times New Roman">Expects a model of
163 rectangle.
Returns the x interval or y interval of the rectangle,
164 depending on the orientation_2d value.
</font><font face=
"Courier New"><br />
168 <td width=
"586"><font face=
"Courier New">template
169 <typename T, typename coordinate_type
><br />
170 void
<b>set
</b>(T
& rectangle, orientation_2d, coordinate_type)
</font></td>
171 <td><font face=
"Times New Roman">Expects a model of
172 rectangle.
Sets the x interval or y interval of the
173 rectangle to the coordinate, depending on the orientation_2d value.
</font></td>
176 <td width=
"586"><font face=
"Courier New">template
177 <typename T
><br />
178 interval_type
<b>get
</b>(const T
& rectangle, orientation_2d,
<br />
179
180 direction_1d)
</font></td>
181 <td><font face=
"Times New Roman">Expects
182 a model of rectangle.
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 />
188 <td width=
"586"><font face=
"Courier New">template
189 <typename T, typename coordinate_type
><br />
190 void
<b>set
</b>(T
& rectangle, orientation_2d, direction_1d,
<br />
191 coordinate_type)
</font></td>
192 <td><font face=
"Times New Roman">Expects a model of
193 rectangle.
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>
198 <td width=
"586"><font face=
"Courier New">template
199 <typename T, typename T2
><br />
200 T
<b>construct
</b>(const T2
& h, const T2
& v)
</font></td>
201 <td>Construct an object that is a model of rectangle given
202 x interval and y intervals.
</td>
205 <td width=
"586"><font face=
"Courier New">template
206 <typename T, typename T2
><br />
207 T
<b>construct
</b>(coordinate_type xl, coordinate_type yl,
<br />
208
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>
214 <td width=
"586"><font face=
"Courier New">template
215 <typename T1, typename T2
><br />
216 T1
& <b>assign
</b>(T1
& left, const T2
& right)
</font></td>
217 <td>Copies data from right object that models rectangle
218 into left object that models rectangle.
</td>
221 <td width=
"586"><font face=
"Courier New">template
222 <typename T, typename T2
><br />
223 bool
<b>equivalence
</b>(const T
& rectangle1,
</font> <br />
224 <font face=
"Courier New">
225 const T2
& 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>
230 <td width=
"586"><font face=
"Courier New">template
231 <typename T, typename point_type
><br />
232 bool
<b>contains
</b>(const T
&, const point_type
& point,
<br />
233
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.
If the consider_touch flag is true will return true if the
238 point lies along the boundary of the rectangle.
</td>
241 <td width=
"586"><font face=
"Courier New">template
242 <typename T1, typename T2
><br />
243 bool
<b>contains
</b>(const T1
& a, const T2
& b,
<br />
244
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.
If the consider_touch flag is
248 true will consider rectangle b contained even if it touches the
252 <td width=
"586"><font face=
"Courier New">template
253 <typename T
><br />
254 interval_type
<b>horizontal
</b>(const T
& rectangle)
</font></td>
255 <td>Returns the x interval of an object that models
259 <td width=
"586"><font face=
"Courier New">template
260 <typename T
><br />
261 interval_type
<b>vertical
</b>(const T
& rectangle)
</font></td>
262 <td>Returns the y interval of an object that models
266 <td width=
"586"><font face=
"Courier New">template
267 <typename T
><br />
268 coordinate_type
<b>xl
</b>(const T
& rectangle)
</font></td>
269 <td>Returns the west coordinate of an object that models
273 <td width=
"586"><font face=
"Courier New">template
274 <typename T
><br />
275 coordinate_type
<b>xh
</b>(const T
& rectangle)
</font></td>
276 <td>Returns the east coordinate of an object that models
280 <td width=
"586"><font face=
"Courier New">template
281 <typename T
><br />
282 coordinate_type
<b>yl
</b>(const T
& rectangle)
</font></td>
283 <td>Returns the south coordinate of an object that models
287 <td width=
"586"><font face=
"Courier New">template
288 <typename T
><br />
289 coordinate_type
<b>yh
</b>(const T
& rectangle)
</font></td>
290 <td>Returns the north coordinate of an object that models
294 <td width=
"586"><font face=
"Courier New">template
295 <typename T
><br />
296 point_type
<b>ll
</b>(const T
& rectangle)
</font></td>
297 <td>Returns the lower left corner point of an object that
298 models rectangle.
</td>
301 <td width=
"586"><font face=
"Courier New">template
302 <typename T
><br />
303 point_type
<b>lr
</b>(const T
& rectangle)
</font></td>
304 <td>Returns the lower right corner point of an object that
305 models rectangle.
</td>
308 <td width=
"586"><font face=
"Courier New">template
309 <typename T
><br />
310 point_type
<b>ul
</b>(const T
& rectangle)
</font></td>
311 <td>Returns the upper left corner point of an object that
312 models rectangle.
</td>
315 <td width=
"586"><font face=
"Courier New">template
316 <typename T
><br />
317 point_type
<b>ur
</b>(const T
& rectangle)
</font></td>
318 <td>Returns the upper right corner point of an object that
319 models rectangle.
</td>
322 <td width=
"586"><font face=
"Courier New">// get the center
324 template
<typename T, typename point_type
><br />
325 void
<b>center
</b>(point_type
& p, const T
& rectangle)
</font></td>
326 <td>Sets object that models point to the center point of an
327 object that models rectangle.
</td>
330 <td width=
"586"><font face=
"Courier New">template
331 <typename T, typename interval_type
><br />
332 void
<b>horizontal
</b>(T
& rectangle, const interval_type
& 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>
337 <td width=
"586"><font face=
"Courier New">template
338 <typename T, typename interval_type
><br />
339 void
<b>vertical
</b>(T
& rectangle, const interval_type
& 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>
344 <td width=
"586"><font face=
"Courier New">template
345 <typename rectangle_type
><br />
346 void
<b>xl
</b>(rectangle_type
& 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>
351 <td width=
"586"><font face=
"Courier New">template
352 <typename rectangle_type
><br />
353 void
<b>xh
</b>(rectangle_type
& 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>
358 <td width=
"586"><font face=
"Courier New">template
359 <typename rectangle_type
><br />
360 void
<b>yl
</b>(rectangle_type
& 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>
365 <td width=
"586"><font face=
"Courier New">template
366 <typename rectangle_type
><br />
367 void
<b>yh
</b>(rectangle_type
& 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>
372 <td width=
"586"><font face=
"Courier New">template
373 <typename T, typename T1, typename T2
><br />
374 T
& <b>set_points
</b>(T
& rectangle, const T1
& p1, const
375 T2
& p2)
</font></td>
376 <td>Sets the rectangle to the rectangle fully described by
377 the points p1 and p2.
</td>
380 <td width=
"586"><font face=
"Courier New">template
381 <typename T
><br />
382 coordinate_difference
<b>delta
</b>(const T
& rectangle,
<br />
383
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>
389 <td width=
"586"><font face=
"Courier New">template
390 <typename T
><br />
391 manhattan_area_type
<b>area
</b>(const T
& rectangle)
</font></td>
392 <td>Returns the area of an object that models rectangle.
</td>
395 <td width=
"586"><font face=
"Courier New">template
396 <typename T
><br />
397 coordinate_difference
<b>half_perimeter
</b>(const T
& rectangle)
</font></td>
398 <td>Returns the length plus width of an object that models
402 <td width=
"586"><font face=
"Courier New">template
403 <typename T
><br />
404 coordinate_difference
<b>perimeter
</b>(const T
& rectangle)
</font></td>
405 <td>Returns the perimeter length of an object that models
409 <td width=
"586"><font face=
"Courier New">template
410 <typename T
><br />
411 orientation_2d
<b>quess_orientation
</b>(const T
& rectangle)
</font></td>
412 <td>Returns the orientation in which the rectangle has a
413 longer delta.
Returns HORIZONTAL if the rectangle is a square.
</td>
416 <td width=
"586"><font face=
"Courier New">template
417 <typename rectangle_type
><br />
418 rectangle_type
& <b>transform
</b>(rectangle_type
& rectangle,
<br />
419
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>
426 <td width=
"586"><font face=
"Courier New">template
427 <typename rectangle_type
><br />
428 rectangle_type
& <b>scale_up
</b>(rectangle_type
& rectangle,
<br />
429
430 unsigned_area_type factor)
</font></td>
431 <td>Scales up x interval and y interval
of an object
432 that models rectangle by unsigned factor.
</td>
435 <td width=
"586"><font face=
"Courier New">template
436 <typename rectangle_type
><br />
437 rectangle_type
& <b>scale_down
</b>(rectangle_type
& rectangle,
<br />
438
439 unsigned_area_type factor)
</font></td>
440 <td>Scales down x interval and y interval
of an
441 object that models rectangle by unsigned factor.
</td>
444 <td width=
"586"><font face=
"Courier New">template
445 <typename rectangle_type, scaling_type
><br />
446 rectangle_type
& <b>scale
</b>(rectangle_type
& rectangle,
<br />
447
448 const scaling_type
& 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>
454 <td width=
"586"><font face=
"Courier New">template
455 <typename T
><br />
456 T
& <b>move
</b>(T
& rectangle, orientation_2d,
<br />
457 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>
463 <td width=
"586"><font face=
"Courier New">template
464 <typename rectangle_type, typename point_type
><br />
465 rectangle_type
& <b>convolve
</b>(rectangle_type
& rectangle,
<br />
466
467 const point_type
& point)
</font></td>
468 <td>Convolves coordinate values of point with x interval
469 and y interval
of an object that models rectangle.
</td>
472 <td width=
"586"><font face=
"Courier New">template
473 <typename rectangle_type, typename point_type
><br />
474 rectangle_type
& <b>deconvolve
</b>(rectangle_type
& rectangle,
<br />
475
476 const point_type
& point)
</font></td>
477 <td>Deconvolves coordinate values of point withx interval
478 and y interval
of an object that models rectangle.
</td>
481 <td width=
"586"><font face=
"Courier New">template
482 <typename T1, typename T2
><br />
483 T1
& <b>convolve
</b>(T1
& a, const T2
& b)
</font></td>
484 <td>Convolves x interval
of b with x interval
485 of a and convolves y interval
of b with y interval
of a.
</td>
488 <td width=
"586"><font face=
"Courier New">template
489 <typename T1, typename T2
><br />
490 T1
& <b>deconvolve
</b>(T1
& a, const T2
& b)
</font></td>
491 <td>Deconvolves x interval
of b with x interval
492 of a and deconvolves y interval
of b with y interval
of a.
</td>
495 <td width=
"586"><font face=
"Courier New">template
496 <typename T1, typename T2
><br />
497 T1
& <b>reflected_convolve
</b>(T1
& a, const T2
& b)
</font></td>
498 <td>Reflected convolves y interval
of b with x
499 interval
of a and reflected convolves x interval
of b with
500 y interval
of a.
</td>
503 <td width=
"586"><font face=
"Courier New">template
504 <typename T1, typename T2
><br />
505 T1
& <b>reflected_deconvolve
</b>(T1
& a, const T2
& b)
</font></td>
506 <td>Reflected deconvolves y interval
of b with x
507 interval
of a and reflected deconvolves x interval
of b
508 with y interval
of a.
</td>
511 <td width=
"586"><font face=
"Courier New">template
512 <typename T, typename point_type
><br />
513 coordinate_difference
<b>euclidean_distance
</b>(const T
&,
<br />
514 const point_type
& 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.
Returns zero if the point is contained within the
519 rectangle along that orientation.
</td>
522 <td width=
"586"><font face=
"Courier New">template
523 <typename T1, typename T2
><br />
524 coordinate_difference
<b>euclidean_distance
</b>(const T1
& a,
<br />
525 const T2
& 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.
Returns zero if the intervals of the rectangles
529 overlap along that orientation.
</td>
532 <td width=
"586"><font face=
"Courier New">template
533 <typename T, typename point_type
><br />
534 coordinate_difference
<b>square_euclidean_distance
</b>(const T
&,
<br />
535 const point_type
& point)
</font></td>
536 <td>Returns the square of the Euclidean distance between a
537 point and a rectangle.
Returns zero if the point is contained
538 within the rectangle.
</td>
541 <td width=
"586"><font face=
"Courier New">template
542 <typename T1, typename T2
><br />
543 coordinate_difference
<b>square_euclidean_distance
</b><br />
544 (const T1
& a, const T2
& b)
</font></td>
545 <td>Returns the square of the Euclidean distance between
546 rectangles a and b.
Returns zero if the rectangles intersect.
</td>
549 <td width=
"586"><font face=
"Courier New">template
550 <typename T, typename point_type
><br />
551 coordinate_difference
<b>manhattan_distance
</b>(const T
&,
<br />
552 const point_type
& point)
</font></td>
553 <td>Returns the Manhattan distance between a point and a
554 rectangle.
Returns zero if the point is contained within the
558 <td width=
"586"><font face=
"Courier New">template
559 <typename T1, typename T2
><br />
560 coordinate_difference
<b>manhattan_distance
</b>(const T1
& a,
<br />
561
562 const T2
& b)
</font></td>
563 <td>Returns the Manhattan distance between rectangles a and
564 b.
Returns zero if the rectangles intersect.
</td>
567 <td width=
"586"><font face=
"Courier New">template
568 <typename T, typename point_type
><br />
569 coordinate_distance
<b>euclidean_distance
</b>(const T
&,
<br />
570 const point_type
& point)
</font></td>
571 <td>Returns the Euclidean distance between a point and a
572 rectangle.
Returns zero if the point is contained within the
576 <td width=
"586"><font face=
"Courier New">template
577 <typename T1, typename T2
><br />
578 coordinate_distance
<b>euclidean_distance
</b>(const T1
& a,
<br />
579
580 const T2
& b)
</font></td>
581 <td>Returns the Euclidean distance between rectangles a and
582 b.
Returns zero if the rectangles intersect.
</td>
585 <td width=
"586"><font face=
"Courier New">template
586 <typename T1, typename T2
><br />
587 bool
<b>intersects
</b>(const T1
& a, const T2
& b,
<br />
588
589 bool consider_touch = true)
</font></td>
590 <td>Returns true if two objects that model rectangle
591 overlap.
If the consider_touch flag is true touching at the sides
592 or corners is considered overlap.
</td>
595 <td width=
"586"><font face=
"Courier New">template
596 <typename T1, typename T2
><br />
597 bool
<b>boundaries_intersect
</b>(const T1
& a, const T2
& b,
<br />
598
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
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>
607 <td width=
"586"><font face=
"Courier New">template
608 <typename T1, typename T2
><br />
609 bool
<b>abuts
</b>(const T1
& a, const T2
& b,
<br />
610
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>
616 <td width=
"586"><font face=
"Courier New">template
617 <typename T1, typename T2
><br />
618 bool
<b>abuts
</b>(const T1
& a, const T2
& b,
<br />
619
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
626 <td width=
"586"><font face=
"Courier New">template
627 <typename T1, typename T2
><br />
628 bool
<b>abuts
</b>(const T1
& a, const T2
& b)
</font></td>
629 <td>Returns true if rectangle b abuts but down not overlap
630 rectangle a on any side.
</td>
633 <td width=
"586"><font face=
"Courier New">template
634 <typename T1, typename T2
><br />
635 bool
<b>intersect
</b>(T1
& a, const T2
& b, orientation_2d
<br />
636
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.
If the does
640 not intersect the interval, the rectangle is unchanged and the function
641 returns false.
If the flag consider_touch is true intervals that
642 abut are considered to intersect.
</td>
645 <td width=
"586"><font face=
"Courier New">template
646 <typename T1, typename T2
><br />
647 bool
<b>intersect
</b>(T1
& a, const T2
& b,
<br />
648
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.
If the two rectangles do not
652 intersect rectangle a is unchanged and the function returns
653 false.
If the flag consider_touch is true rectangles that abut
654 are considered to intersect.
</td>
657 <td width=
"586"><font face=
"Courier New">template
658 <typename T1, typename T2
><br />
659 T
& <b>generalized_intersect
</b>(T1
& a, const T2
& 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>
665 <td width=
"586"><font face=
"Courier New">template
666 <typename T
><br />
667 T
& <b>bloat
</b>(T
& rectangle, coordinate_type)
</font></td>
668 <td>Bloats x and y intervals of rectangle by coordinate
672 <td width=
"586"><font face=
"Courier New">template
673 <typename T
><br />
674 T
& <b>bloat
</b>(T
& rectangle, direction_2d, coordinate_type)
</font></td>
675 <td>Bloats side of rectangle specified by direction_2d by
676 coordinate value.
</td>
679 <td width=
"586"><font face=
"Courier New">template
680 <typename T
><br />
681 T
& <b>bloat
</b>(T
& rectangle, orientation_2d, coordinate_type)
</font></td>
682 <td>Bloats interval of rectangle specified by
683 orientation_2d by coordinate value.
</td>
686 <td width=
"586"><font face=
"Courier New">template
687 <typename T
><br />
688 T
& <b>shrink
</b>(T
& rectangle, coordinate_type)
</font></td>
689 <td>Shrinks x and y intervals of rectangle by coordinate
693 <td width=
"586"><font face=
"Courier New">template
694 <typename T
><br />
695 T
& <b>shrink
</b>(T
& rectangle, direction_2d, coordinate_type)
</font></td>
696 <td>Shrinks side of rectangle specified by direction_2d by
697 coordinate value.
</td>
700 <td width=
"586"><font face=
"Courier New">template
701 <typename T
><br />
702 T
& <b>shrink
</b>(T
& rectangle, orientation_2d, coordinate_type)
</font></td>
703 <td>Shrinks interval of rectangle specified by
704 orientation_2d by coordinate value.
</td>
707 <td width=
"586"><font face=
"Courier New">template
708 <typename T1, typename T2
><br />
709 bool
<b>encompass
</b>(T1
& a, const T2
& 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>
714 <td width=
"586"><font face=
"Courier New">template
715 <typename T, typename point_type
><br />
716 bool
<b>encompass
</b>(T
& rectangle, const point_type
& 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>
721 <td width=
"586"><font face=
"Courier New">template
722 <typename T, typename interval_type
><br />
723 bool
<b>encompass
</b>(T
& rectangle, const interval_type
& i,
<br />
724
725 orientation_2d)
</font></td>
726 <td>The interval of rectangle specified by orientation_2d
727 is set to encompass the interval i.
</td>
730 <td width=
"586"><font face=
"Courier New">template
731 <typename T, typename point_type
><br />
732 bool
<b>get_corner
</b>(point_type
& point, const T
&
733 rectangle,
<br />
734
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).
Always returns true.
</td>
743 <h1>Rectangle Data
</h1>
745 <p>The library provides a model of rectangle concept declared
746 <font face=
"Courier New">template
<typename T
>
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.
The
751 data type is implemented to be convenient to use with the library
754 <table id=
"table2" border=
"1" width=
"100%">
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>
761 <td width=
"586"><b><font face=
"Courier New">coordinate_type
</font></b></td>
762 <td><font face=
"Times New Roman">T
</font></td>
765 <td width=
"586"><font face=
"Courier New"><b>interval_type
</b></font></td>
766 <td><font face=
"Times New Roman">interval_data
<T
></font></td>
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>
775 <td width=
"586"><font face=
"Courier New">template
776 <typename T1, typename T2
><b><br />
777 rectangle_data
</b>(const T1
& horizontal_interval,
<br />
778
779 const T2
& vertical_interval)
</font></td>
780 <td><font face=
"Times New Roman">Constructs a rectangle
781 with two objects that model interval.
</font></td>
784 <td width=
"586"><font face=
"Courier New"><b>rectangle_data
</b>(const
785 rectangle_data
& that)
</font></td>
786 <td><font face=
"Times New Roman">Copy construct
</font></td>
789 <td width=
"586"><font face=
"Courier New">rectangle_data
&
790 <b>operator=
</b>(const rectangle_data
& that)
</font></td>
791 <td>Assignment operator.
</td>
794 <td width=
"586"><font face=
"Courier New">template
795 <typename T2
><b> <br />
796 </b>rectangle_data
& <b> operator=
</b>(const T2
&
797 that) const
</font></td>
798 <td>Assign from an object that is a model of rectangle.
</td>
801 <td width=
"586"><font face=
"Courier New">template
802 <typename T2
><b> <br />
803 </b>bool
<b> operator==
</b>(const T2
& that) const
</font></td>
804 <td>Compare equality to an object that is a model of
808 <td width=
"586"><font face=
"Courier New">template
809 <typename T2
><b> <br />
810 </b>bool
<b> operator!=
</b>(const T2
& that) const
</font></td>
811 <td>Compare inequality to an object that is a model of
815 <td width=
"586"><font face=
"Courier New">interval_data
<T
>
816 <b>get
</b>(orientation_2d orient) const
</font></td>
817 <td>Get the interval in the given orientation.
</td>
820 <td width=
"586"><font face=
"Courier New">template
821 <typename T2
><br />
822 void
<b>set
</b>(orientation_2d orient, const T2
& value)
</font></td>
823 <td>Sets the interval in the given orientation to the value
824 of an object that models interval.
</td>
831 <td style=
"background-color: rgb(238, 238, 238);" nowrap=
"1"
832 valign=
"top"> </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">
840 <th class=
"docinfo-name">Copyright:
</th>
841 <td>Copyright © Intel Corporation
2008-
2010.
</td>
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>