blob: a8ed2bed4d23cf778b2f80137c0ddb969c90bcea [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en">
<head>
<!--
Copyright 2009-2010 Intel Corporation
license banner
-->
<title>Boost Polygon Library: Rectangle Concept</title>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
<!-- <link type="text/css" rel="stylesheet" href="adobe_source.css"> -->
</head>
<body>
<table style="margin: 0pt; padding: 0pt; width: 100%;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="background-color: rgb(238, 238, 238);" nowrap="1"
valign="top">
<div style="padding: 5px;" align="center"> <img
src="images/boost.png" border="0" height="86" width="277" /><a
title="www.boost.org home page" href="http://www.boost.org/"
tabindex="2" style="border: medium none ;"> </a> </div>
<div style="margin: 5px;">
<h3 class="navbar">Contents</h3>
<ul>
<li><a href="index.htm">Boost.Polygon Main Page</a></li>
<li><a href="gtl_design_overview.htm">Design Overview</a></li>
<li><a href="gtl_isotropy.htm">Isotropy</a></li>
<li><a href="gtl_coordinate_concept.htm">Coordinate Concept</a></li>
<li><a href="gtl_interval_concept.htm">Interval Concept</a></li>
<li><a href="gtl_point_concept.htm">Point Concept</a></li>
<li><a href="gtl_segment_concept.htm">Segment Concept</a></li>
<li>Rectangle Concept</li>
<li><a href="gtl_polygon_90_concept.htm">Polygon 90 Concept</a></li>
<li><a href="gtl_polygon_90_with_holes_concept.htm">Polygon 90
With Holes Concept</a></li>
<li><a href="gtl_polygon_45_concept.htm">Polygon 45 Concept</a></li>
<li><a href="gtl_polygon_45_with_holes_concept.htm">Polygon 45
With Holes Concept</a></li>
<li><a href="gtl_polygon_concept.htm">Polygon Concept</a></li>
<li><a href="gtl_polygon_with_holes_concept.htm">Polygon With
Holes Concept</a></li>
<li><a href="gtl_polygon_90_set_concept.htm">Polygon 90 Set
Concept</a></li>
<li><a href="gtl_polygon_45_set_concept.htm">Polygon 45 Set
Concept</a></li>
<li><a href="gtl_polygon_set_concept.htm">Polygon Set Concept</a></li>
<li><a href="gtl_connectivity_extraction_90.htm">Connectivity
Extraction 90</a></li>
<li><a href="gtl_connectivity_extraction_45.htm">Connectivity
Extraction 45</a></li>
<li><a href="gtl_connectivity_extraction.htm">Connectivity
Extraction</a></li>
<li><a href="gtl_property_merge_90.htm">Property Merge 90</a></li>
<li><a href="gtl_property_merge_45.htm">Property Merge 45</a></li>
<li><a href="gtl_property_merge.htm">Property Merge</a></li>
<li><a href="voronoi_main.htm">Voronoi Main Page<br />
</a></li>
<li><a href="voronoi_benchmark.htm">Voronoi Benchmark</a><br />
</li>
<li><a href="voronoi_builder.htm">Voronoi Builder</a></li>
<li><a href="voronoi_diagram.htm">Voronoi Diagram</a></li>
</ul>
<h3 class="navbar">Other Resources</h3>
<ul>
<li><a href="GTL_boostcon2009.pdf">GTL Boostcon 2009 Paper</a></li>
<li><a href="GTL_boostcon_draft03.pdf">GTL Boostcon 2009
Presentation</a></li>
<li><a href="analysis.htm">Performance Analysis</a></li>
<li><a href="gtl_tutorial.htm">Layout Versus Schematic Tutorial</a></li>
<li><a href="gtl_minkowski_tutorial.htm">Minkowski Sum Tutorial</a></li>
<li><a href="voronoi_basic_tutorial.htm">Voronoi Basic Tutorial</a></li>
<li><a href="voronoi_advanced_tutorial.htm">Voronoi Advanced
Tutorial</a></li>
</ul>
</div>
<h3 class="navbar">Polygon Sponsor</h3>
<div style="padding: 5px;" align="center"> <img
src="images/intlogo.gif" border="0" height="51" width="127" /><a
title="www.adobe.com home page" href="http://www.adobe.com/"
tabindex="2" style="border: medium none ;"> </a> </div>
</td>
<td
style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
valign="top" width="100%">
<!-- End Header --><br />
<p>
</p>
<h1>Rectangle Concept</h1>
<p> </p>
<p>The rectangle concept tag is <font face="Courier New">
rectangle_concept</font></p>
<p> To register a user defined type as a model of <font
face="Times New Roman">rectangle </font>concept, specialize the
geometry concept meta-function for that type.&nbsp; In the example
below CRectangle is registered as a model of rectangle&nbsp; concept.</p>
<p> <font face="Courier New">template &lt;&gt;<br />
struct geometry_concept&lt;CRectangle&gt; { typedef rectangle_concept
type; };</font></p>
<p> <font face="Times New Roman">The semantic of a rectangle is
that it has an x and a y interval and these intervals conform to the
semantic of an interval including its invariant.&nbsp; This invariant
on the intervals of a rectangle is enforced by the generic library
functions that operate on rectangles, and is not expected of the data
type itself or the concept mapping of that data type to the rectangle
concept through its traits.&nbsp; In this way a boost::tuple&lt;int,
int, int, int&gt; or boost::array&lt;int, 4&gt; could be made models of
rectangle by simply providing indirect access to their elements through
traits.</font></p>
<p> <font face="Times New Roman">Below is shown the default
rectangle traits.&nbsp; Specialization of these traits is required for
types that don't conform to the default behavior.&nbsp; The interested
reader will note SFINAE is used on the traits to allow only an object
that provides a member type definition of interval_type to work with
the default read only traits.&nbsp; This becomes necessary when
refinements of concepts are used and it is undesirable to attempt to
match default traits to non-rectangle types at compile time.&nbsp;
Specializing rectangle_traits can be done easily by simply providing
gtl_yes as the enable parameter.</font></p>
<p> <font face="Courier New">template &lt;typename T, typename
enable = gtl_yes&gt;<br />
struct rectangle_traits {};</font></p>
<p> <font face="Courier New">template &lt;typename T&gt;<br />
struct rectangle_traits&lt;T, gtl_no&gt; {};<br />
<br />
template &lt;typename T&gt;<br />
struct rectangle_traits&lt;T, typename gtl_same_type&lt;typename
T::interval_type, typename T::interval_type&gt;::type&gt; {<br />
&nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::coordinate_type
coordinate_type;<br />
&nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::interval_type
interval_type;<br />
&nbsp;&nbsp;&nbsp;&nbsp; static inline interval_type get(const T&amp;
rectangle, orientation_2d orient) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
rectangle.get(orient); }<br />
};<br />
<br />
template &lt;typename T&gt;<br />
struct rectangle_mutable_traits {<br />
&nbsp;&nbsp;&nbsp;&nbsp; template &lt;typename T2&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp; static inline void set(T&amp; rectangle,
orientation_2d orient, const T2&amp; interval) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
rectangle.set(orient, interval); }<br />
&nbsp;&nbsp;&nbsp;&nbsp; template &lt;typename T2, typename T3&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp; static inline T construct(const T2&amp;
interval_horizontal, const T3&amp; interval_vertical) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
T(interval_horizontal, interval_vertical); }<br />
};</font></p>
<h2>Functions</h2>
<table id="table1" border="1" width="100%">
<tbody>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
interval_type <b>get</b>(const T&amp; rectangle, orientation_2d)</font></td>
<td><font face="Times New Roman">Expects a model of
rectangle.&nbsp; Returns the x interval or y interval of the rectangle,
depending on the orientation_2d value.</font><font face="Courier New"><br />
&nbsp;</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename coordinate_type&gt;<br />
void <b>set</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
<td><font face="Times New Roman">Expects a model of
rectangle.&nbsp;&nbsp; Sets the x interval or y interval of the
rectangle to the coordinate, depending on the orientation_2d value.</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
interval_type <b>get</b>(const T&amp; rectangle, orientation_2d, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
direction_1d)</font></td>
<td><font face="Times New Roman">Expects
a model of rectangle.&nbsp; Returns the coordinate specificed by the
direction_1d value of the x interval or y interval of the rectangle,
depending on the orientation_2d value.</font><font face="Courier New"><br />
&nbsp;</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename coordinate_type&gt;<br />
void <b>set</b>(T&amp; rectangle, orientation_2d, direction_1d, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_type)</font></td>
<td><font face="Times New Roman">Expects a model of
rectangle.&nbsp;&nbsp; Sets the coordinate specified by the
direction_1d value of the x interval or y interval of the rectangle to
the coordinate, depending on the orientation_2d value.</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename T2&gt;<br />
T <b>construct</b>(const T2&amp; h, const T2&amp; v)</font></td>
<td>Construct an object that is a model of rectangle given
x interval and y intervals.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename T2&gt;<br />
T <b>construct</b>(coordinate_type xl, coordinate_type yl, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
coordinate_type xh, coordinate_type yh)</font></td>
<td>Construct an object that is a model of rectangle given
four coordinate values.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T1&amp; <b>assign</b>(T1&amp; left, const T2&amp; right)</font></td>
<td>Copies data from right object that models rectangle
into left object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename T2&gt;<br />
bool <b>equivalence</b>(const T&amp; rectangle1, </font> <br />
<font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
const T2&amp; rectangle2)</font></td>
<td>Given two objects that model rectangle, compares and
returns true if their x and y intervals are respectively equivalent.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
bool <b>contains</b>(const T&amp;, const point_type&amp; point, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bool consider_touch=true)</font></td>
<td>Given an object that models rectangle and an object
that models point, returns true if the rectangle contains the
point.&nbsp; If the consider_touch flag is true will return true if the
point lies along the boundary of the rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>contains</b>(const T1&amp; a, const T2&amp; b, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bool consider_touch = true) </font></td>
<td>Returns true if model of rectangle a contains both
intervals of model of rectangle b.&nbsp; If the consider_touch flag is
true will consider rectangle b contained even if it touches the
boundary of a.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
interval_type <b>horizontal</b>(const T&amp; rectangle)</font></td>
<td>Returns the x interval of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
interval_type <b>vertical</b>(const T&amp; rectangle)</font></td>
<td>Returns the y interval of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_type <b>xl</b>(const T&amp; rectangle)</font></td>
<td>Returns the west coordinate of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_type <b>xh</b>(const T&amp; rectangle)</font></td>
<td>Returns the east coordinate of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_type <b>yl</b>(const T&amp; rectangle)</font></td>
<td>Returns the south coordinate of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_type <b>yh</b>(const T&amp; rectangle)</font></td>
<td>Returns the north coordinate of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
point_type <b>ll</b>(const T&amp; rectangle)</font></td>
<td>Returns the lower left corner point of an object that
models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
point_type <b>lr</b>(const T&amp; rectangle)</font></td>
<td>Returns the lower right corner point of an object that
models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
point_type <b>ul</b>(const T&amp; rectangle)</font></td>
<td>Returns the upper left corner point of an object that
models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
point_type <b>ur</b>(const T&amp; rectangle)</font></td>
<td>Returns the upper right corner point of an object that
models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">// get the center
coordinate<br />
template &lt;typename T, typename point_type&gt;<br />
void <b>center</b>(point_type&amp; p, const T&amp; rectangle)</font></td>
<td>Sets object that models point to the center point of an
object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename interval_type&gt;<br />
void <b>horizontal</b>(T&amp; rectangle, const interval_type&amp; i)</font></td>
<td>Sets the x interval of the object that models rectangle
to be equal to the value of an object that models interval.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename interval_type&gt;<br />
void <b>vertical</b>(T&amp; rectangle, const interval_type&amp; i )</font></td>
<td>Sets the y interval of the object that models rectangle
to be equal to the value of an object that models interval.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
void <b>xl</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
<td>Sets the west coordinate of the object that models
rectangle to be equal to the coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
void <b>xh</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
<td>Sets the east coordinate of the object that models
rectangle to be equal to the coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
void <b>yl</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
<td>Sets the south coordinate of the object that models
rectangle to be equal to the coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
void <b>yh</b>(rectangle_type&amp; rectangle, coordinate_type )</font></td>
<td>Sets the north coordinate of the object that models
rectangle to be equal to the coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename T1, typename T2&gt;<br />
T&amp; <b>set_points</b>(T&amp; rectangle, const T1&amp; p1, const
T2&amp; p2)</font></td>
<td>Sets the rectangle to the rectangle fully described by
the points p1 and p2.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_difference <b>delta</b>(const T&amp; rectangle, <br />
&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;
orientation_2d)</font></td>
<td>Returns the delta of the interval specified by
orientation_2d of an object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
manhattan_area_type <b>area</b>(const T&amp; rectangle)</font></td>
<td>Returns the area of an object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_difference <b>half_perimeter</b>(const T&amp; rectangle)</font></td>
<td>Returns the length plus width of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
coordinate_difference <b>perimeter</b>(const T&amp; rectangle)</font></td>
<td>Returns the perimeter length of an object that models
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
orientation_2d <b>quess_orientation</b>(const T&amp; rectangle)</font></td>
<td>Returns the orientation in which the rectangle has a
longer delta.&nbsp; Returns HORIZONTAL if the rectangle is a square.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
rectangle_type&amp; <b>transform</b>(rectangle_type&amp; rectangle,<br />
&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;
coordinate_type axis = 0)</font></td>
<td>Applies transform() on the two points that fully
describe the rectangle and sets the rectangle to that described by the
result of transforming those points.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
rectangle_type&amp; <b>scale_up</b>(rectangle_type&amp; rectangle, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned_area_type factor)</font></td>
<td>Scales up x interval and y interval&nbsp; of an object
that models rectangle by unsigned factor.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type&gt;<br />
rectangle_type&amp; <b>scale_down</b>(rectangle_type&amp; rectangle, <br />
&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;
unsigned_area_type factor)</font></td>
<td>Scales down x interval and y interval&nbsp; of an
object that models rectangle by unsigned factor.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type, scaling_type&gt;<br />
rectangle_type&amp; <b>scale</b>(rectangle_type&amp; rectangle,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
const scaling_type&amp; scaling) </font></td>
<td>Applies scale() on the two points that fully describe
the rectangle and sets the rectangle to that described by the result of
transforming those points.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>move</b>(T&amp; rectangle, orientation_2d,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_difference
displacement)</font></td>
<td>Adds displacement value to interval indicated by
orientation_2d of an object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type, typename point_type&gt;<br />
rectangle_type&amp; <b>convolve</b>(rectangle_type&amp; rectangle,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
const point_type&amp; point)</font></td>
<td>Convolves coordinate values of point with x interval
and y interval&nbsp; of an object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename rectangle_type, typename point_type&gt;<br />
rectangle_type&amp; <b>deconvolve</b>(rectangle_type&amp; rectangle,<br />
&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;
const point_type&amp; point)</font></td>
<td>Deconvolves coordinate values of point withx interval
and y interval&nbsp; of an object that models rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T1&amp; <b>convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>Convolves x interval&nbsp; of b with x interval&nbsp;
of a and convolves y interval&nbsp; of b with y interval&nbsp; of a.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T1&amp; <b>deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>Deconvolves x interval&nbsp; of b with x interval&nbsp;
of a and deconvolves y interval&nbsp; of b with y interval&nbsp; of a. </td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T1&amp; <b>reflected_convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>Reflected convolves y interval&nbsp; of b with x
interval&nbsp; of a and reflected convolves x interval&nbsp; of b with
y interval&nbsp; of a.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T1&amp; <b>reflected_deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>Reflected deconvolves y interval&nbsp; of b with x
interval&nbsp; of a and reflected deconvolves x interval&nbsp; of b
with y interval&nbsp; of a.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
coordinate_difference <b>euclidean_distance</b>(const T&amp;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point,
orienation_2d)</font></td>
<td>Returns the distance from an object that models
rectangle to an object that models point along the given
orientation.&nbsp; Returns zero if the point is contained within the
rectangle along that orientation.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
coordinate_difference <b>euclidean_distance</b>(const T1&amp; a,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const T2&amp; b, orienation_2d)</font></td>
<td>Returns the distance from an object that models
rectangle to an object that models rectangle along the given
orientation.&nbsp; Returns zero if the intervals of the rectangles
overlap along that orientation.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
coordinate_difference <b>square_euclidean_distance</b>(const T&amp;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
<td>Returns the square of the Euclidean distance between a
point and a rectangle.&nbsp; Returns zero if the point is contained
within the rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
coordinate_difference <b>square_euclidean_distance</b><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (const T1&amp; a, const T2&amp; b)</font></td>
<td>Returns the square of the Euclidean distance between
rectangles a and b.&nbsp; Returns zero if the rectangles intersect.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
coordinate_difference <b>manhattan_distance</b>(const T&amp;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
<td>Returns the Manhattan distance between a point and a
rectangle.&nbsp; Returns zero if the point is contained within the
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
coordinate_difference <b>manhattan_distance</b>(const T1&amp; a, <br />
&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;
const T2&amp; b)</font></td>
<td>Returns the Manhattan distance between rectangles a and
b.&nbsp; Returns zero if the rectangles intersect.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
coordinate_distance <b>euclidean_distance</b>(const T&amp;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type&amp; point)</font></td>
<td>Returns the Euclidean distance between a point and a
rectangle.&nbsp; Returns zero if the point is contained within the
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
coordinate_distance <b>euclidean_distance</b>(const T1&amp; a, <br />
&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;
const T2&amp; b)</font></td>
<td>Returns the Euclidean distance between rectangles a and
b.&nbsp; Returns zero if the rectangles intersect.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>intersects</b>(const T1&amp; a, const T2&amp; b, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bool consider_touch = true)</font></td>
<td>Returns true if two objects that model rectangle
overlap.&nbsp; If the consider_touch flag is true touching at the sides
or corners is considered overlap.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>boundaries_intersect</b>(const T1&amp; a, const T2&amp; b, <br />
&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;
bool consider_touch = true)</font></td>
<td>Returns true is two objects that model rectangle
partially overlap such that one there is an intersection between the
edges of the two rectangles&nbsp; If the consider_touch flag is true a
coordinate is considered contained even if the two rectangles touch
only along a side or corner.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>abuts</b>(const T1&amp; a, const T2&amp; b,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
direction_2d dir) </font></td>
<td>Returns true if rectangle b abuts but down not overlap
rectangle a on the side of rectangle a specified by dir.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>abuts</b>(const T1&amp; a, const T2&amp; b,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
orientation_2d) </font></td>
<td>Returns true if rectangle b abuts but down not overlap
rectangle a on either side of rectangle a specified by the
orientation_2d.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>abuts</b>(const T1&amp; a, const T2&amp; b)</font></td>
<td>Returns true if rectangle b abuts but down not overlap
rectangle a on any side.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>intersect</b>(T1&amp; a, const T2&amp; b, orientation_2d<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bool consider_touch = true) </font></td>
<td>Sets rectangle a to the intersection of rectangle a and
interval b along the orientation_2d and returns true.&nbsp; If the does
not intersect the interval, the rectangle is unchanged and the function
returns false.&nbsp; If the flag consider_touch is true intervals that
abut are considered to intersect.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>intersect</b>(T1&amp; a, const T2&amp; b,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bool consider_touch = true) </font></td>
<td>Sets rectangle a to the intersection of rectangle a and
rectangle b and return true.&nbsp; If the two rectangles do not
intersect rectangle a is unchanged and the function returns
false.&nbsp; If the flag consider_touch is true rectangles that abut
are considered to intersect.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
T&amp; <b>generalized_intersect</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>Same as intersect, but if they do not intersect set a
to the rectangle between a and b by applying generalized_intersect() on
the intervals of the rectangles.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>bloat</b>(T&amp; rectangle, coordinate_type)</font></td>
<td>Bloats x and y intervals of rectangle by coordinate
value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>bloat</b>(T&amp; rectangle, direction_2d, coordinate_type)</font></td>
<td>Bloats side of rectangle specified by direction_2d by
coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>bloat</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
<td>Bloats interval of rectangle specified by
orientation_2d by coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>shrink</b>(T&amp; rectangle, coordinate_type)</font></td>
<td>Shrinks x and y intervals of rectangle by coordinate
value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>shrink</b>(T&amp; rectangle, direction_2d, coordinate_type)</font></td>
<td>Shrinks side of rectangle specified by direction_2d by
coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T&gt;<br />
T&amp; <b>shrink</b>(T&amp; rectangle, orientation_2d, coordinate_type)</font></td>
<td>Shrinks interval of rectangle specified by
orientation_2d by coordinate value.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<br />
bool <b>encompass</b>(T1&amp; a, const T2&amp; b)</font></td>
<td>The x and y intervals of a are set to encompass the x
and y intervals of b respectively.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
bool <b>encompass</b>(T&amp; rectangle, const point_type&amp; point)</font></td>
<td>The x and y intervals of rectangle are set to encompass
the x and y coordinates of point respectively.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename interval_type&gt;<br />
bool <b>encompass</b>(T&amp; rectangle, const interval_type&amp; i, <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
orientation_2d)</font></td>
<td>The interval of rectangle specified by orientation_2d
is set to encompass the interval i.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T, typename point_type&gt;<br />
bool <b>get_corner</b>(point_type&amp; point, const T&amp;
rectangle,&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
direction_2d, direction_1d)</font></td>
<td>Sets point to the corner of the rectangle you reach if
you look at its side specified by direction_2d from within the
rectangle and turn in the direction_1d direction (low == left, high =
right).&nbsp; Always returns true.</td>
</tr>
</tbody>
</table>
<h1>Rectangle Data</h1>
<p> </p>
<p>The library provides a model of rectangle concept declared
<font face="Courier New">template&lt;typename T&gt;
rectangle_data </font>where T is the coordinate type.</p>
<p>This data type is used internally when a rectangle is needed
and is available to the library user who finds it convenient to use a
library rectangle data type instead of providing their own.&nbsp; The
data type is implemented to be convenient to use with the library
traits.</p>
<h2>Members</h2>
<table id="table2" border="1" width="100%">
<tbody>
<tr>
<td width="586"><b><font face="Courier New">geometry_type</font></b></td>
<td><font face="Times New Roman">rectangle_concept</font></td>
</tr>
<tr>
<td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
<td><font face="Times New Roman">T</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New"><b>interval_type</b></font></td>
<td><font face="Times New Roman">interval_data&lt;T&gt;</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New"><b>rectangle_data</b>(T
xl, T yl, T xh, T yh)</font></td>
<td><font face="Times New Roman">Constructs a rectangle
with four coordinates.</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T1, typename T2&gt;<b><br />
rectangle_data</b>(const T1&amp; horizontal_interval,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
const T2&amp; vertical_interval)</font></td>
<td><font face="Times New Roman">Constructs a rectangle
with two objects that model interval.</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New"><b>rectangle_data</b>(const
rectangle_data&amp; that)</font></td>
<td><font face="Times New Roman">Copy construct</font></td>
</tr>
<tr>
<td width="586"><font face="Courier New">rectangle_data&amp;
<b>operator=</b>(const rectangle_data&amp; that)</font></td>
<td>Assignment operator.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T2&gt;<b> <br />
</b>rectangle_data&amp; <b> operator=</b>(const T2&amp;
that) const</font></td>
<td>Assign from an object that is a model of rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T2&gt;<b> <br />
</b>bool<b> operator==</b>(const T2&amp; that) const</font></td>
<td>Compare equality to an object that is a model of
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T2&gt;<b> <br />
</b>bool<b> operator!=</b>(const T2&amp; that) const</font></td>
<td>Compare inequality to an object that is a model of
rectangle.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">interval_data&lt;T&gt;
<b>get</b>(orientation_2d orient) const</font></td>
<td>Get the interval in the given orientation.</td>
</tr>
<tr>
<td width="586"><font face="Courier New">template
&lt;typename T2&gt;<br />
void <b>set</b>(orientation_2d orient, const T2&amp; value)</font></td>
<td>Sets the interval in the given orientation to the value
of an object that models interval.</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="background-color: rgb(238, 238, 238);" nowrap="1"
valign="top"> &nbsp;</td>
<td
style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
valign="top" width="100%">
<table class="docinfo" id="table8" frame="void" rules="none">
<colgroup> <col class="docinfo-name" /><col
class="docinfo-content" /> </colgroup> <tbody valign="top">
<tr>
<th class="docinfo-name">Copyright:</th>
<td>Copyright © Intel Corporation 2008-2010.</td>
</tr>
<tr class="field">
<th class="docinfo-name">License:</th>
<td class="field-body">Distributed under the Boost Software
License, Version 1.0. (See accompanying file <tt class="literal"> <span
class="pre">LICENSE_1_0.txt</span></tt> or copy at <a
class="reference" target="_top"
href="http://www.boost.org/LICENSE_1_0.txt">
http://www.boost.org/LICENSE_1_0.txt</a>)</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>