mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-13 12:32:09 +00:00
243 lines
16 KiB
HTML
243 lines
16 KiB
HTML
<!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">
|
|
|
|
</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 Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related 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 class="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li><a href="examples.html"><span>Examples</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
<li><a href="globals.html"><span>File Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<h1>boost/geometry/algorithms/overlay/self_intersection_points.hpp</h1><a href="self__intersection__points_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Boost.Geometry (aka GGL, Generic Geometry Library)</span>
|
|
<a name="l00002"></a>00002 <span class="comment">//</span>
|
|
<a name="l00003"></a>00003 <span class="comment">// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.</span>
|
|
<a name="l00004"></a>00004 <span class="comment">// Copyright Bruno Lalande 2008, 2009</span>
|
|
<a name="l00005"></a>00005 <span class="comment">// Use, modification and distribution is subject to the Boost Software License,</span>
|
|
<a name="l00006"></a>00006 <span class="comment">// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at</span>
|
|
<a name="l00007"></a>00007 <span class="comment">// http://www.boost.org/LICENSE_1_0.txt)</span>
|
|
<a name="l00008"></a>00008
|
|
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef BOOST_GEOMETRY_ALGORITHMS_OVERLAY_SELF_INTERSECTION_POINTS_HPP</span>
|
|
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_GEOMETRY_ALGORITHMS_OVERLAY_SELF_INTERSECTION_POINTS_HPP</span>
|
|
<a name="l00011"></a>00011 <span class="preprocessor"></span>
|
|
<a name="l00012"></a>00012 <span class="preprocessor">#include <cstddef></span>
|
|
<a name="l00013"></a>00013
|
|
<a name="l00014"></a>00014 <span class="preprocessor">#include <boost/range/functions.hpp></span>
|
|
<a name="l00015"></a>00015 <span class="preprocessor">#include <boost/range/metafunctions.hpp></span>
|
|
<a name="l00016"></a>00016 <span class="preprocessor">#include <boost/type_traits/remove_const.hpp></span>
|
|
<a name="l00017"></a>00017
|
|
<a name="l00018"></a>00018 <span class="preprocessor">#include <<a class="code" href="access_8hpp.html">boost/geometry/core/access.hpp</a>></span>
|
|
<a name="l00019"></a>00019 <span class="preprocessor">#include <<a class="code" href="coordinate__dimension_8hpp.html">boost/geometry/core/coordinate_dimension.hpp</a>></span>
|
|
<a name="l00020"></a>00020 <span class="preprocessor">#include <<a class="code" href="core_2is__multi_8hpp.html">boost/geometry/core/is_multi.hpp</a>></span>
|
|
<a name="l00021"></a>00021
|
|
<a name="l00022"></a>00022 <span class="preprocessor">#include <<a class="code" href="geometries_2concepts_2check_8hpp.html">boost/geometry/geometries/concepts/check.hpp</a>></span>
|
|
<a name="l00023"></a>00023
|
|
<a name="l00024"></a>00024 <span class="preprocessor">#include <<a class="code" href="detail_2disjoint_8hpp.html">boost/geometry/algorithms/detail/disjoint.hpp</a>></span>
|
|
<a name="l00025"></a>00025 <span class="preprocessor">#include <<a class="code" href="get__intersection__points_8hpp.html">boost/geometry/algorithms/overlay/get_intersection_points.hpp</a>></span>
|
|
<a name="l00026"></a>00026
|
|
<a name="l00027"></a>00027
|
|
<a name="l00028"></a>00028 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>geometry
|
|
<a name="l00029"></a>00029 {
|
|
<a name="l00030"></a>00030
|
|
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef DOXYGEN_NO_DETAIL</span>
|
|
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="keyword">namespace </span>detail { <span class="keyword">namespace </span>self_intersection_points {
|
|
<a name="l00033"></a>00033
|
|
<a name="l00034"></a>00034 <span class="keyword">template</span>
|
|
<a name="l00035"></a>00035 <
|
|
<a name="l00036"></a>00036 <span class="keyword">typename</span> Geometry,
|
|
<a name="l00037"></a>00037 <span class="keyword">typename</span> IntersectionPoints,
|
|
<a name="l00038"></a>00038 <span class="keyword">typename</span> IntersectionStrategy
|
|
<a name="l00039"></a>00039 >
|
|
<a name="l00040"></a>00040 <span class="keyword">struct </span>check_ips
|
|
<a name="l00041"></a>00041 {
|
|
<a name="l00042"></a>00042 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> apply(
|
|
<a name="l00043"></a>00043 Geometry <span class="keyword">const</span>& geometry,
|
|
<a name="l00044"></a>00044 <span class="keywordtype">bool</span> return_if_found,
|
|
<a name="l00045"></a>00045 IntersectionPoints& intersection_points)
|
|
<a name="l00046"></a>00046 {
|
|
<a name="l00047"></a>00047 <span class="keyword">typedef</span> <span class="keyword">typename</span> geometry::sections
|
|
<a name="l00048"></a>00048 <
|
|
<a name="l00049"></a>00049 geometry::box < typename geometry::point_type<Geometry>::type >, 1
|
|
<a name="l00050"></a>00050 > sections_type;
|
|
<a name="l00051"></a>00051
|
|
<a name="l00052"></a>00052 sections_type sec;
|
|
<a name="l00053"></a>00053 <a class="code" href="group__sectionalize.html#g5f4d5b585d242d644a1b0b60c805b930" title="Split a geometry into monotonic sections.">geometry::sectionalize</a>(geometry, sec);
|
|
<a name="l00054"></a>00054
|
|
<a name="l00055"></a>00055 <span class="keywordtype">bool</span> trivial = <span class="keyword">true</span>;
|
|
<a name="l00056"></a>00056 <span class="keywordflow">for</span> (<span class="keyword">typename</span> boost::range_const_iterator<sections_type>::type
|
|
<a name="l00057"></a>00057 it1 = sec.begin();
|
|
<a name="l00058"></a>00058 it1 != sec.end();
|
|
<a name="l00059"></a>00059 ++it1)
|
|
<a name="l00060"></a>00060 {
|
|
<a name="l00061"></a>00061 <span class="keywordflow">for</span> (<span class="keyword">typename</span> boost::range_const_iterator<sections_type>::type
|
|
<a name="l00062"></a>00062 it2 = sec.begin();
|
|
<a name="l00063"></a>00063 it2 != sec.end();
|
|
<a name="l00064"></a>00064 ++it2)
|
|
<a name="l00065"></a>00065 {
|
|
<a name="l00066"></a>00066 <span class="keywordflow">if</span> (! geometry::detail::disjoint::disjoint_box_box(
|
|
<a name="l00067"></a>00067 it1->bounding_box, it2->bounding_box)
|
|
<a name="l00068"></a>00068 && ! it1->duplicate
|
|
<a name="l00069"></a>00069 && ! it2->duplicate
|
|
<a name="l00070"></a>00070 )
|
|
<a name="l00071"></a>00071 {
|
|
<a name="l00072"></a>00072 geometry::detail::get_intersection_points::get_ips_in_sections
|
|
<a name="l00073"></a>00073 <
|
|
<a name="l00074"></a>00074 Geometry, Geometry,
|
|
<a name="l00075"></a>00075 <span class="keyword">typename</span> boost::range_value<sections_type>::type,
|
|
<a name="l00076"></a>00076 <span class="keyword">typename</span> boost::range_value<sections_type>::type,
|
|
<a name="l00077"></a>00077 IntersectionPoints, IntersectionStrategy
|
|
<a name="l00078"></a>00078 >::apply(
|
|
<a name="l00079"></a>00079 0, geometry, *it1,
|
|
<a name="l00080"></a>00080 0, geometry, *it2,
|
|
<a name="l00081"></a>00081 return_if_found,
|
|
<a name="l00082"></a>00082 intersection_points, trivial);
|
|
<a name="l00083"></a>00083 }
|
|
<a name="l00084"></a>00084 }
|
|
<a name="l00085"></a>00085 }
|
|
<a name="l00086"></a>00086 <span class="keywordflow">return</span> trivial;
|
|
<a name="l00087"></a>00087 }
|
|
<a name="l00088"></a>00088 };
|
|
<a name="l00089"></a>00089
|
|
<a name="l00090"></a>00090
|
|
<a name="l00091"></a>00091 }} <span class="comment">// namespace detail::self_intersection_points</span>
|
|
<a name="l00092"></a>00092 <span class="preprocessor">#endif // DOXYGEN_NO_DETAIL</span>
|
|
<a name="l00093"></a>00093 <span class="preprocessor"></span>
|
|
<a name="l00094"></a>00094
|
|
<a name="l00095"></a>00095 <span class="preprocessor">#ifndef DOXYGEN_NO_DISPATCH</span>
|
|
<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="keyword">namespace </span>dispatch
|
|
<a name="l00097"></a>00097 {
|
|
<a name="l00098"></a>00098
|
|
<a name="l00099"></a>00099 <span class="keyword">template</span>
|
|
<a name="l00100"></a>00100 <
|
|
<a name="l00101"></a>00101 <span class="keyword">typename</span> GeometryTag,
|
|
<a name="l00102"></a>00102 <span class="keywordtype">bool</span> IsMulti,
|
|
<a name="l00103"></a>00103 <span class="keyword">typename</span> Geometry,
|
|
<a name="l00104"></a>00104 <span class="keyword">typename</span> IntersectionPoints,
|
|
<a name="l00105"></a>00105 <span class="keyword">typename</span> IntersectionStrategy
|
|
<a name="l00106"></a>00106 >
|
|
<a name="l00107"></a>00107 <span class="keyword">struct </span>self_intersection_points
|
|
<a name="l00108"></a>00108 {
|
|
<a name="l00109"></a>00109 };
|
|
<a name="l00110"></a>00110
|
|
<a name="l00111"></a>00111
|
|
<a name="l00112"></a>00112 <span class="keyword">template</span><<span class="keyword">typename</span> Ring, <span class="keyword">typename</span> IntersectionPo<span class="keywordtype">int</span>s, <span class="keyword">typename</span> IntersectionStrategy>
|
|
<a name="l00113"></a>00113 <span class="keyword">struct </span>self_intersection_points
|
|
<a name="l00114"></a>00114 <
|
|
<a name="l00115"></a>00115 ring_tag, false, Ring,
|
|
<a name="l00116"></a>00116 IntersectionPoints,
|
|
<a name="l00117"></a>00117 IntersectionStrategy
|
|
<a name="l00118"></a>00118 >
|
|
<a name="l00119"></a>00119 : detail::self_intersection_points::check_ips
|
|
<a name="l00120"></a>00120 <
|
|
<a name="l00121"></a>00121 Ring,
|
|
<a name="l00122"></a>00122 IntersectionPoints,
|
|
<a name="l00123"></a>00123 IntersectionStrategy
|
|
<a name="l00124"></a>00124 >
|
|
<a name="l00125"></a>00125 {};
|
|
<a name="l00126"></a>00126
|
|
<a name="l00127"></a>00127
|
|
<a name="l00128"></a>00128 <span class="keyword">template</span><<span class="keyword">typename</span> Polygon, <span class="keyword">typename</span> IntersectionPo<span class="keywordtype">int</span>s, <span class="keyword">typename</span> IntersectionStrategy>
|
|
<a name="l00129"></a>00129 <span class="keyword">struct </span>self_intersection_points
|
|
<a name="l00130"></a>00130 <
|
|
<a name="l00131"></a>00131 polygon_tag, false, Polygon,
|
|
<a name="l00132"></a>00132 IntersectionPoints, IntersectionStrategy
|
|
<a name="l00133"></a>00133 >
|
|
<a name="l00134"></a>00134 : detail::self_intersection_points::check_ips
|
|
<a name="l00135"></a>00135 <
|
|
<a name="l00136"></a>00136 Polygon,
|
|
<a name="l00137"></a>00137 IntersectionPoints,
|
|
<a name="l00138"></a>00138 IntersectionStrategy
|
|
<a name="l00139"></a>00139 >
|
|
<a name="l00140"></a>00140 {};
|
|
<a name="l00141"></a>00141
|
|
<a name="l00142"></a>00142
|
|
<a name="l00143"></a>00143 } <span class="comment">// namespace dispatch</span>
|
|
<a name="l00144"></a>00144 <span class="preprocessor">#endif // DOXYGEN_NO_DISPATCH</span>
|
|
<a name="l00145"></a>00145 <span class="preprocessor"></span>
|
|
<a name="l00146"></a>00146
|
|
<a name="l00156"></a>00156 <span class="keyword">template</span> <<span class="keyword">typename</span> Geometry, <span class="keyword">typename</span> IntersectionPo<span class="keywordtype">int</span>s>
|
|
<a name="l00157"></a><a class="code" href="group__overlay.html#ga7cd2b066df0a800eed0ee0e64525c46">00157</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__overlay.html#g5ca19485a71af4c4ccba3de2bb08680a" title="Calculate intersection points of two geometries.">get_intersection_points</a>(Geometry <span class="keyword">const</span>& geometry,
|
|
<a name="l00158"></a>00158 IntersectionPoints& intersection_points)
|
|
<a name="l00159"></a>00159 {
|
|
<a name="l00160"></a>00160 concept::check<Geometry>();
|
|
<a name="l00161"></a>00161
|
|
<a name="l00162"></a>00162 <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structboost_1_1geometry_1_1strategy__intersection.html">strategy_intersection</a>
|
|
<a name="l00163"></a>00163 <
|
|
<a name="l00164"></a>00164 <span class="keyword">typename</span> <a class="code" href="structboost_1_1geometry_1_1cs__tag.html" title="Meta-function returning coordinate system tag (cs family) of any geometry.">cs_tag<Geometry>::type</a>,
|
|
<a name="l00165"></a>00165 Geometry,
|
|
<a name="l00166"></a>00166 Geometry,
|
|
<a name="l00167"></a>00167 <span class="keyword">typename</span> boost::range_value<IntersectionPoints>::type
|
|
<a name="l00168"></a>00168 >::segment_intersection_strategy_type segment_intersection_strategy_type;
|
|
<a name="l00169"></a>00169
|
|
<a name="l00170"></a>00170 <span class="keyword">typedef</span> <span class="keyword">typename</span> boost::remove_const<Geometry>::type ncg_type;
|
|
<a name="l00171"></a>00171
|
|
<a name="l00172"></a>00172 <span class="keywordflow">return</span> dispatch::self_intersection_points
|
|
<a name="l00173"></a>00173 <
|
|
<a name="l00174"></a>00174 <span class="keyword">typename</span> <a class="code" href="structboost_1_1geometry_1_1geometry__not__recognized__tag.html" title="&quot;default&quot; tag">tag<ncg_type>::type</a>,
|
|
<a name="l00175"></a>00175 <a class="code" href="structboost_1_1geometry_1_1is__multi.html" title="Meta-function defining &quot;true&quot; for multi geometries (multi_point, etc).">is_multi<ncg_type>::type::value</a>,
|
|
<a name="l00176"></a>00176 ncg_type,
|
|
<a name="l00177"></a>00177 IntersectionPoints, segment_intersection_strategy_type
|
|
<a name="l00178"></a>00178 >::apply(geometry, <span class="keyword">false</span>, intersection_points);
|
|
<a name="l00179"></a>00179 }
|
|
<a name="l00180"></a>00180
|
|
<a name="l00181"></a>00181
|
|
<a name="l00182"></a>00182
|
|
<a name="l00183"></a>00183 }} <span class="comment">// namespace boost::geometry</span>
|
|
<a name="l00184"></a>00184
|
|
<a name="l00185"></a>00185 <span class="preprocessor">#endif // BOOST_GEOMETRY_ALGORITHMS_OVERLAY_SELF_INTERSECTION_POINTS_HPP</span>
|
|
</pre></div></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 © 1995-2009 Barend Gehrels, Geodan, Amsterdam<br>
|
|
Copyright © 2008-2009 Bruno Lalande, Paris<br>
|
|
Copyright © 2009 Mateusz Loskot, Cadcorp, London<br>
|
|
</small>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<address style="text-align: right;"><small>
|
|
Documentation is generated by <a href="http://www.doxygen.org/index.html">Doxygen</a>
|
|
</small></address>
|
|
</body>
|
|
</html>
|