geometry/doc/doxygen_output/html/group__within.html
Barend Gehrels 363580fbf6 Added old doxygen docs
[SVN r59777]
2010-02-20 15:57:12 +00:00

204 lines
12 KiB
HTML
Raw Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Geometry (aka GGL, Generic Geometry Library)</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<table cellpadding="2" width="100%">
<tbody>
<tr>
<td valign="top">
<img alt="Boost.Geometry" src="images/ggl-logo-big.png" height="80" width="200">
&nbsp;&nbsp;
</td>
<td valign="top" align="right">
<a href="http://www.boost.org">
<img alt="Boost C++ Libraries" src="images/accepted_by_boost.png" height="80" width="230" border="0">
</a>
</td>
</tr>
</tbody>
</table>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>within: detect if a geometry is inside another geometry, a.o. point-in-polygon</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1geometry_1_1concept_1_1_within_strategy.html">boost::geometry::concept::WithinStrategy&lt; Strategy &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Checks <a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a> for within (point-in-polygon). <a href="classboost_1_1geometry_1_1concept_1_1_within_strategy.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1geometry_1_1strategy__within.html">boost::geometry::strategy_within&lt; TagPoint, TagSegment, Point, PointOfSegment &gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Traits class binding a within determination <a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a> to a coordinate system. <a href="structboost_1_1geometry_1_1strategy__within.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename Geometry1 , typename Geometry2 , typename Strategy &gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__within.html#g9a06b4c46fcf0a8443c4e3958073fa67">boost::geometry::within</a> (Geometry1 const &amp;geometry1, Geometry2 const &amp;geometry2, Strategy const &amp;strategy)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Within, examine if a <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> is within another <a class="el" href="namespaceboost_1_1geometry.html">geometry</a>, using a specified <a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a>. <a href="#g9a06b4c46fcf0a8443c4e3958073fa67"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename Geometry1 , typename Geometry2 &gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__within.html#ge8d7fe4e3391e7e0cadf14cc23b7cec1">boost::geometry::within</a> (Geometry1 const &amp;geometry1, Geometry2 const &amp;geometry2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Within, examine if a <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> is within another <a class="el" href="namespaceboost_1_1geometry.html">geometry</a>. <a href="#ge8d7fe4e3391e7e0cadf14cc23b7cec1"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<dl class="user" compact><dt><b>Source descriptions:</b></dt><dd><ul>
<li>OGC: Returns 1 (TRUE) if this geometric object is "spatially within" another Geometry.</li></ul>
</dd></dl>
<dl class="user" compact><dt><b>Performance</b></dt><dd><ul>
<li>2776 within determinations using bounding box and polygon are done in 0.05 seconds (<a href="http://trac.osgeo.org/ggl/wiki/Performance#Within1">http://trac.osgeo.org/ggl/wiki/Performance#Within1</a>)</li><li>note that using another strategy the performance can be increased:<ul>
<li>winding : 0.093 s</li><li>franklin : 0.062 s</li><li>Crossings-multiply : 0.047 s</li></ul>
</li><li>but note also that the last two do not detect point-on-border cases</li></ul>
</dd></dl>
<dl class="user" compact><dt><b>Geometries:</b></dt><dd><ul>
<li><b>point</b> + <b>polygon:</b> The well-known point-in-polygon, returning true if a point falls within a polygon (and not within one of its holes) <div align="center">
<img src="within_polygon.png" alt="within_polygon.png">
</div>
</li><li><b>point</b> + <b>ring:</b> returns true if point is completely within a ring <div align="center">
<img src="within_ring.png" alt="within_ring.png">
</div>
</li><li><b>point</b> + <b>box</b> </li><li><b>box</b> + <b>box</b> </li></ul>
</dd></dl>
<dl class="user" compact><dt><b>Example:</b></dt><dd>The within algorithm is used as following: <div class="fragment"><pre class="fragment">{
<a class="code" href="classboost_1_1geometry_1_1polygon.html" title="The polygon contains an outer ring and zero or more inner rings.">boost::geometry::polygon&lt;boost::geometry::point_xy&lt;double&gt;</a> &gt; poly;
boost::geometry::read_wkt(<span class="stringliteral">"POLYGON((0 0,0 7,4 2,2 0,0 0))"</span>, poly);
<a class="code" href="classboost_1_1geometry_1_1point__xy.html" title="2D point in Cartesian coordinate system">boost::geometry::point_xy&lt;float&gt;</a> point(3, 3);
std::cout &lt;&lt; <span class="stringliteral">"Point is "</span>
&lt;&lt; (<a class="code" href="group__within.html#ge8d7fe4e3391e7e0cadf14cc23b7cec1" title="Within, examine if a geometry is within another geometry.">boost::geometry::within</a>(point, poly) ? <span class="stringliteral">"IN"</span> : <span class="stringliteral">"NOT in"</span>)
&lt;&lt; <span class="stringliteral">" polygon"</span>
&lt;&lt; std::endl;
}
</pre></div> </dd></dl>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ge8d7fe4e3391e7e0cadf14cc23b7cec1"></a><!-- doxytag: member="boost::geometry::within" ref="ge8d7fe4e3391e7e0cadf14cc23b7cec1" args="(Geometry1 const &amp;geometry1, Geometry2 const &amp;geometry2)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Geometry1 , typename Geometry2 &gt; </div>
<table class="memname">
<tr>
<td class="memname">bool boost::geometry::within </td>
<td>(</td>
<td class="paramtype">Geometry1 const &amp;&nbsp;</td>
<td class="paramname"> <em>geometry1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Geometry2 const &amp;&nbsp;</td>
<td class="paramname"> <em>geometry2</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Within, examine if a <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> is within another <a class="el" href="namespaceboost_1_1geometry.html">geometry</a>.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>geometry1</em>&nbsp;</td><td><a class="el" href="namespaceboost_1_1geometry.html">geometry</a> which might be within the second <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> </td></tr>
<tr><td valign="top"></td><td valign="top"><em>geometry2</em>&nbsp;</td><td><a class="el" href="namespaceboost_1_1geometry.html">geometry</a> which might contain the first <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>true if geometry1 is completely contained within geometry2, else false </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The default <a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a> is used for within detection </dd></dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="03__polygon__example_8cpp-example.html#a12">03_polygon_example.cpp</a>, <a class="el" href="c02__custom__box__example_8cpp-example.html#a5">c02_custom_box_example.cpp</a>, and <a class="el" href="x01__qt__example_8cpp-example.html#a3">x01_qt_example.cpp</a>.</dl>
<p>Definition at line <a class="el" href="algorithms_2within_8hpp_source.html#l00314">314</a> of file <a class="el" href="algorithms_2within_8hpp_source.html">within.hpp</a>.</p>
</div>
</div><p>
<a class="anchor" name="g9a06b4c46fcf0a8443c4e3958073fa67"></a><!-- doxytag: member="boost::geometry::within" ref="g9a06b4c46fcf0a8443c4e3958073fa67" args="(Geometry1 const &amp;geometry1, Geometry2 const &amp;geometry2, Strategy const &amp;strategy)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Geometry1 , typename Geometry2 , typename Strategy &gt; </div>
<table class="memname">
<tr>
<td class="memname">bool boost::geometry::within </td>
<td>(</td>
<td class="paramtype">Geometry1 const &amp;&nbsp;</td>
<td class="paramname"> <em>geometry1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Geometry2 const &amp;&nbsp;</td>
<td class="paramname"> <em>geometry2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Strategy const &amp;&nbsp;</td>
<td class="paramname"> <em>strategy</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Within, examine if a <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> is within another <a class="el" href="namespaceboost_1_1geometry.html">geometry</a>, using a specified <a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a>.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>geometry1</em>&nbsp;</td><td><a class="el" href="namespaceboost_1_1geometry.html">geometry</a> which might be within the second <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> </td></tr>
<tr><td valign="top"></td><td valign="top"><em>geometry2</em>&nbsp;</td><td><a class="el" href="namespaceboost_1_1geometry.html">geometry</a> which might contain the first <a class="el" href="namespaceboost_1_1geometry.html">geometry</a> </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a></em>&nbsp;</td><td><a class="el" href="namespaceboost_1_1geometry_1_1strategy.html">strategy</a> to be used </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>true if geometry1 is completely contained within geometry2, else false </dd></dl>
<p>Definition at line <a class="el" href="algorithms_2within_8hpp_source.html#l00351">351</a> of file <a class="el" href="algorithms_2within_8hpp_source.html">within.hpp</a>.</p>
</div>
</div><p>
</div>
<hr size="1">
<table width="100%">
<tbody>
<tr>
<td align="left"><small>
<p>December 1, 2009</p>
</small></td>
<td align="right">
<small>Copyright <20> 1995-2009 Barend Gehrels, Geodan, Amsterdam<br>
Copyright <20> 2008-2009 Bruno Lalande, Paris<br>
Copyright <20> 2009 Mateusz Loskot, Cadcorp, London<br>
</small>
</td>
</tr>
</tbody>
</table>
<address style="text-align: right;"><small>
Documentation is generated by&nbsp;<a href="http://www.doxygen.org/index.html">Doxygen</a>
</small></address>
</body>
</html>