mirror of
https://github.com/boostorg/polygon.git
synced 2026-02-14 00:52:09 +00:00
750 lines
36 KiB
HTML
750 lines
36 KiB
HTML
<!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" 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"><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">
|
||
<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 border="0" src="images/boost.png" width="277" height="86"><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>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>
|
||
</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>
|
||
</ul>
|
||
</div>
|
||
<h3 class="navbar">Polygon Sponsor</h3>
|
||
<div style="padding: 5px;" align="center">
|
||
<img border="0" src="images/intlogo.gif" width="127" height="51">
|
||
</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>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. In the example below CRectangle is registered as a model of
|
||
rectangle concept.<p>
|
||
<font face="Courier New">template <><br>
|
||
struct geometry_concept<CRectangle> { typedef rectangle_concept type; };</font><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. 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. In
|
||
this way a boost::tuple<int, int, int, int> or boost::array<int, 4>
|
||
could be made models of rectangle by simply providing indirect access to their
|
||
elements through traits.</font><p>
|
||
<font face="Times New Roman">Below is shown the default rectangle traits.
|
||
Specialization of these traits is required for types that don't conform to the
|
||
default behavior. 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. 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.
|
||
Specializing rectangle_traits can be done easily by simply providing gtl_yes as
|
||
the enable parameter.</font><p>
|
||
<font face="Courier New">template <typename T, typename enable = gtl_yes><br>
|
||
struct rectangle_traits {};</font><p>
|
||
<font face="Courier New">template <typename T><br>
|
||
struct rectangle_traits<T, gtl_no> {};<br>
|
||
<br>
|
||
template <typename T><br>
|
||
struct rectangle_traits<T, typename gtl_same_type<typename T::interval_type,
|
||
typename T::interval_type>::type> {<br>
|
||
typedef typename T::coordinate_type coordinate_type;<br>
|
||
typedef typename T::interval_type interval_type;<br>
|
||
static inline interval_type get(const T& rectangle,
|
||
orientation_2d orient) {<br>
|
||
return
|
||
rectangle.get(orient); }<br>
|
||
};<br>
|
||
<br>
|
||
template <typename T><br>
|
||
struct rectangle_mutable_traits {<br>
|
||
template <typename T2><br>
|
||
static inline void set(T& rectangle, orientation_2d
|
||
orient, const T2& interval) {<br>
|
||
rectangle.set(orient,
|
||
interval); }<br>
|
||
template <typename T2, typename T3><br>
|
||
static inline T construct(const T2& interval_horizontal,
|
||
const T3& interval_vertical) {<br>
|
||
return
|
||
T(interval_horizontal, interval_vertical); }<br>
|
||
};</font><h2>Functions</h2>
|
||
<table border="1" width="100%" id="table1">
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T><br>
|
||
interval_type <b>get</b>(const T& rectangle, orientation_2d)</font></td>
|
||
<td><font face="Times New Roman">Expects a model of rectangle.
|
||
Returns the x interval or y interval of the rectangle, depending on the
|
||
orientation_2d value.</font><font face="Courier New"><br>
|
||
</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T, typename
|
||
coordinate_type><br>
|
||
void <b>set</b>(T& rectangle, orientation_2d, coordinate_type)</font></td>
|
||
<td><font face="Times New Roman">Expects a model of rectangle.
|
||
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 <typename T><br>
|
||
interval_type <b>get</b>(const T& rectangle, orientation_2d,
|
||
<br> direction_1d)</font></td>
|
||
<td><font face="Times New Roman">Expects a model of rectangle.
|
||
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>
|
||
</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T, typename
|
||
coordinate_type><br>
|
||
void <b>set</b>(T& rectangle, orientation_2d, direction_1d, <br> coordinate_type)</font></td>
|
||
<td><font face="Times New Roman">Expects a model of rectangle.
|
||
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 <typename T, typename
|
||
T2><br>
|
||
T <b>construct</b>(const T2& h, const T2& 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 <typename T, typename
|
||
T2><br>
|
||
T <b>construct</b>(coordinate_type xl, coordinate_type yl, <br> 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 <typename T1, typename
|
||
T2><br>
|
||
T1& <b>assign</b>(T1& left, const T2& 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 <typename T, typename
|
||
T2><br>
|
||
bool <b>equivalence</b>(const T& rectangle1, </font>
|
||
<br><font face="Courier New"> const T2& 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 <typename T,
|
||
typename point_type><br>
|
||
bool <b>contains</b>(const T&, const point_type& point, <br>
|
||
|
||
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. 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>contains</b>(const T1& a, const T2& b, <br>
|
||
|
||
bool consider_touch = true) </font></td>
|
||
<td>Returns true if model of rectangle a contains both intervals of
|
||
model of rectangle b. 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 <typename T><br>
|
||
interval_type <b>horizontal</b>(const T& 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 <typename T><br>
|
||
interval_type <b>vertical</b>(const T& 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 <typename T><br>
|
||
coordinate_type <b>xl</b>(const T& 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 <typename T><br>
|
||
coordinate_type <b>xh</b>(const T& 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 <typename T><br>
|
||
coordinate_type <b>yl</b>(const T& 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 <typename T><br>
|
||
coordinate_type <b>yh</b>(const T& 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 <typename T><br>
|
||
point_type <b>ll</b>(const T& 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 <typename T><br>
|
||
point_type <b>lr</b>(const T& 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 <typename T><br>
|
||
point_type <b>ul</b>(const T& 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 <typename T><br>
|
||
point_type <b>ur</b>(const T& 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 <typename T, typename point_type><br>
|
||
void <b>center</b>(point_type& p, const T& 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 <typename T,
|
||
typename interval_type><br>
|
||
void <b>horizontal</b>(T& rectangle, const interval_type& 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 <typename T,
|
||
typename interval_type><br>
|
||
void <b>vertical</b>(T& rectangle, const interval_type& 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 <typename
|
||
rectangle_type><br>
|
||
void <b>xl</b>(rectangle_type& 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 <typename
|
||
rectangle_type><br>
|
||
void <b>xh</b>(rectangle_type& 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 <typename
|
||
rectangle_type><br>
|
||
void <b>yl</b>(rectangle_type& 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 <typename
|
||
rectangle_type><br>
|
||
void <b>yh</b>(rectangle_type& 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 <typename T,
|
||
typename T1, typename T2><br>
|
||
T& <b>set_points</b>(T& rectangle, const T1& p1, const T2& 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 <typename T><br>
|
||
coordinate_difference <b>delta</b>(const T& rectangle,
|
||
<br> 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 <typename T><br>
|
||
manhattan_area_type <b>area</b>(const T& rectangle)</font></td>
|
||
<td>Returns the area of an object
|
||
that models rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T><br>
|
||
coordinate_difference <b>half_perimeter</b>(const T& 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 <typename T><br>
|
||
coordinate_difference <b>perimeter</b>(const T& 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 <typename T><br>
|
||
orientation_2d <b>quess_orientation</b>(const T& rectangle)</font></td>
|
||
<td>Returns the orientation in which the rectangle has a longer delta.
|
||
Returns HORIZONTAL if the rectangle is a square.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename
|
||
rectangle_type><br>
|
||
rectangle_type& <b>transform</b>(rectangle_type& rectangle,<br>
|
||
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 <typename
|
||
rectangle_type><br>
|
||
rectangle_type& <b>scale_up</b>(rectangle_type& rectangle, <br>
|
||
unsigned_area_type factor)</font></td>
|
||
<td>Scales up x interval and y interval of an object that models
|
||
rectangle by unsigned factor.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename
|
||
rectangle_type><br>
|
||
rectangle_type& <b>scale_down</b>(rectangle_type& rectangle, <br>
|
||
unsigned_area_type factor)</font></td>
|
||
<td>Scales down x interval and y interval of an object that models
|
||
rectangle by unsigned factor.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename
|
||
rectangle_type, scaling_type><br>
|
||
rectangle_type& <b>scale</b>(rectangle_type& rectangle,<br>
|
||
|
||
const scaling_type& 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 <typename T><br>
|
||
T& <b>move</b>(T& rectangle, orientation_2d,<br>
|
||
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 <typename
|
||
rectangle_type, typename point_type><br>
|
||
rectangle_type& <b>convolve</b>(rectangle_type& rectangle,<br>
|
||
|
||
const point_type& point)</font></td>
|
||
<td>Convolves coordinate values of point with x interval and y interval of an
|
||
object that models rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename
|
||
rectangle_type, typename point_type><br>
|
||
rectangle_type& <b>deconvolve</b>(rectangle_type& rectangle,<br>
|
||
|
||
const point_type& point)</font></td>
|
||
<td>Deconvolves coordinate values of point withx interval and y interval of
|
||
an object that models rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1, typename
|
||
T2><br>
|
||
T1& <b>convolve</b>(T1& a, const T2& b)</font></td>
|
||
<td>Convolves x interval of b with x interval of a and
|
||
convolves y
|
||
interval of b with y interval of a.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1, typename
|
||
T2><br>
|
||
T1& <b>deconvolve</b>(T1& a, const T2& b)</font></td>
|
||
<td>Deconvolves x interval of b with x interval of a and
|
||
deconvolves y interval of b with y interval of a. </td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1, typename
|
||
T2><br>
|
||
T1& <b>reflected_convolve</b>(T1& a, const T2& b)</font></td>
|
||
<td>Reflected convolves y interval of b with x interval of a and
|
||
reflected convolves x
|
||
interval of b with y interval of a.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1, typename
|
||
T2><br>
|
||
T1& <b>reflected_deconvolve</b>(T1& a, const T2& b)</font></td>
|
||
<td>Reflected deconvolves y interval of b with x interval of a and
|
||
reflected deconvolves x interval of b with y interval of a.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T,
|
||
typename point_type><br>
|
||
coordinate_difference <b>euclidean_distance</b>(const T&,<br>
|
||
const point_type& 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. Returns zero
|
||
if the point is contained within the rectangle along that orientation.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1,
|
||
typename T2><br>
|
||
coordinate_difference <b>euclidean_distance</b>(const T1& a,<br>
|
||
const T2& 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. Returns
|
||
zero if the intervals of the rectangles overlap along that orientation.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T,
|
||
typename point_type><br>
|
||
coordinate_difference <b>square_euclidean_distance</b>(const T&,<br>
|
||
const point_type& point)</font></td>
|
||
<td>Returns the square of the Euclidean distance between a point and a
|
||
rectangle. Returns zero if the point is contained within the
|
||
rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1,
|
||
typename T2><br>
|
||
coordinate_difference <b>square_euclidean_distance</b><br>
|
||
(const T1& a, const T2& b)</font></td>
|
||
<td>Returns the square of the Euclidean distance between rectangles a
|
||
and b. Returns zero if the rectangles intersect.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T,
|
||
typename point_type><br>
|
||
coordinate_difference <b>manhattan_distance</b>(const T&,<br>
|
||
const point_type& point)</font></td>
|
||
<td>Returns the Manhattan distance between a point and a rectangle.
|
||
Returns zero if the point is contained within the rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1,
|
||
typename T2><br>
|
||
coordinate_difference <b>manhattan_distance</b>(const T1& a, <br>
|
||
|
||
const T2& b)</font></td>
|
||
<td>Returns the Manhattan distance between rectangles a and b.
|
||
Returns zero if the rectangles intersect.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T,
|
||
typename point_type><br>
|
||
coordinate_distance <b>euclidean_distance</b>(const T&,<br>
|
||
const point_type& point)</font></td>
|
||
<td>Returns the Euclidean distance between a point and a rectangle.
|
||
Returns zero if the point is contained within the rectangle.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1,
|
||
typename T2><br>
|
||
coordinate_distance <b>euclidean_distance</b>(const T1& a, <br>
|
||
|
||
const T2& b)</font></td>
|
||
<td>Returns the Euclidean distance between rectangles a and b.
|
||
Returns zero if the rectangles intersect.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T1, typename
|
||
T2><br>
|
||
bool <b>intersects</b>(const T1& a, const T2& b, <br>
|
||
|
||
bool consider_touch = true)</font></td>
|
||
<td>Returns true if two objects that model rectangle overlap. 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>boundaries_intersect</b>(const T1& a, const T2& b, <br>
|
||
|
||
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 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>abuts</b>(const T1& a, const T2& b,<br>
|
||
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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>abuts</b>(const T1& a, const T2& b,<br>
|
||
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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>abuts</b>(const T1& a, const T2& 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>intersect</b>(T1& a, const T2& b, orientation_2d<br>
|
||
|
||
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. If the does not intersect the interval, the
|
||
rectangle is unchanged and the function returns false. 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>intersect</b>(T1& a, const T2& b,<br>
|
||
|
||
bool consider_touch = true) </font></td>
|
||
<td>Sets rectangle a to the intersection of rectangle a and rectangle b
|
||
and return true. If the two rectangles do not intersect rectangle
|
||
a is unchanged and the function returns false. 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 <typename T1, typename
|
||
T2><br>
|
||
T& <b>generalized_intersect</b>(T1& a, const T2& 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 <typename T><br>
|
||
T& <b>bloat</b>(T& 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 <typename T><br>
|
||
T& <b>bloat</b>(T& 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 <typename T><br>
|
||
T& <b>bloat</b>(T& 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 <typename T><br>
|
||
T& <b>shrink</b>(T& 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 <typename T><br>
|
||
T& <b>shrink</b>(T& 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 <typename T><br>
|
||
T& <b>shrink</b>(T& 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 <typename T1, typename
|
||
T2><br>
|
||
bool <b>encompass</b>(T1& a, const T2& 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 <typename T, typename
|
||
point_type><br>
|
||
bool <b>encompass</b>(T& rectangle, const point_type& 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 <typename T, typename
|
||
interval_type><br>
|
||
bool <b>encompass</b>(T& rectangle, const interval_type& i,
|
||
<br> 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 <typename T, typename
|
||
point_type><br>
|
||
bool <b>get_corner</b>(point_type& point, const T& rectangle,
|
||
<br>
|
||
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). Always
|
||
returns true.</td>
|
||
</tr>
|
||
</table>
|
||
<h1>Rectangle Data</h1>
|
||
|
||
<p>
|
||
<p>The library provides a model of rectangle concept declared
|
||
<font face="Courier New">
|
||
template<typename T> 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. The data type is implemented to be
|
||
convenient to use with the library traits.</p>
|
||
<h2>Members</h2>
|
||
<table border="1" width="100%" id="table2">
|
||
<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<T></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 <typename T1, typename
|
||
T2><b><br>
|
||
rectangle_data</b>(const T1& horizontal_interval,<br>
|
||
|
||
const T2& 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& that)</font></td>
|
||
<td><font face="Times New Roman">Copy construct</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">rectangle_data& <b>operator=</b>(const
|
||
rectangle_data& that)</font></td>
|
||
<td>Assignment operator.</td>
|
||
</tr>
|
||
<tr>
|
||
<td width="586"><font face="Courier New">template <typename T2><b>
|
||
<br> </b>rectangle_data& <b>
|
||
operator=</b>(const T2& 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 <typename T2><b>
|
||
<br> </b>bool<b>
|
||
operator==</b>(const T2& 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 <typename T2><b>
|
||
<br> </b>bool<b>
|
||
operator!=</b>(const T2& 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<T> <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 <typename T2><br>
|
||
void <b>set</b>(orientation_2d orient, const T2& value)</font></td>
|
||
<td>Sets the interval in the given orientation to the value of an object
|
||
that models interval.</td>
|
||
</tr>
|
||
</table>
|
||
<tr>
|
||
<td style="background-color: rgb(238, 238, 238);" nowrap="1" valign="top">
|
||
</td>
|
||
<td style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;" valign="top" width="100%">
|
||
|
||
|
||
<table class="docinfo" rules="none" frame="void" id="table3">
|
||
<colgroup>
|
||
<col class="docinfo-name"><col class="docinfo-content">
|
||
</colgroup>
|
||
<tbody vAlign="top">
|
||
<tr>
|
||
<th class="docinfo-name">Copyright:</th>
|
||
<td>Copyright <20> 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>
|
||
</table>
|
||
|
||
</html> |