<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libnfporb API Reference: src/algo/touching_point.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libnfporb API Reference
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_8111f045ab156cab490d6e0f8a4c6c64.html">algo</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">touching_point.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="touching__point_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#ifndef SRC_ALGO_TOUCHING_POINT_HPP_</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#define SRC_ALGO_TOUCHING_POINT_HPP_</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160; </div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;../geometry.hpp&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160; </div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacelibnfporb.html">libnfporb</a> {</div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html">   11</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structlibnfporb_1_1TouchingPoint.html">TouchingPoint</a> {</div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5">   18</a></span>&#160;    <span class="keyword">enum</span> <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5">Type</a> {</div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a4c8372a94c69e5b0e1ebfa11b89a4ecf">   19</a></span>&#160;        <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a4c8372a94c69e5b0e1ebfa11b89a4ecf">VERTEX</a>,</div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5afc9b5dd72baef51ad1c3b7267d7424b5">   20</a></span>&#160;        <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5afc9b5dd72baef51ad1c3b7267d7424b5">A_ON_B</a>,</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;        <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a03f232c73ef66c6bf1850f06b9b35cd1">B_ON_A</a> </div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a03f232c73ef66c6bf1850f06b9b35cd1">   22</a></span>&#160;    };</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#aaade2069496c42a4f147cbf64f96c2b1">   23</a></span>&#160;    <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5">Type</a> <a class="code" href="structlibnfporb_1_1TouchingPoint.html#aaade2069496c42a4f147cbf64f96c2b1">type_</a>;</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#ac1374a2f822841422b7fd2379554d41f">   27</a></span>&#160;    <a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> <a class="code" href="structlibnfporb_1_1TouchingPoint.html#ac1374a2f822841422b7fd2379554d41f">A_</a>;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structlibnfporb_1_1TouchingPoint.html#a75de8d3c56c6d69aa2ca36d642af1c27">   31</a></span>&#160;    <a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> <a class="code" href="structlibnfporb_1_1TouchingPoint.html#a75de8d3c56c6d69aa2ca36d642af1c27">B_</a>;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;};</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="namespacelibnfporb.html#adef64d071f04a643db9eb39c7b12acb1">   40</a></span>&#160;std::vector&lt;TouchingPoint&gt; <a class="code" href="namespacelibnfporb.html#adef64d071f04a643db9eb39c7b12acb1">find_touching_points</a>(<span class="keyword">const</span> polygon_t::ring_type&amp; ringA, <span class="keyword">const</span> polygon_t::ring_type&amp; ringB) {</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    std::vector&lt;TouchingPoint&gt; touchers;</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordflow">for</span> (<a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> i = 0; i &lt; ringA.size() - 1; i++) {</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> nextI = i + 1;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        <span class="keywordflow">for</span> (<a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> j = 0; j &lt; ringB.size() - 1; j++) {</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;            <a class="code" href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">psize_t</a> nextJ = j + 1;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="namespacelibnfporb.html#a2e318553169d53a7150a00a79bd2762d">equals</a>(ringA[i], ringB[j])) {</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                <a class="code" href="geometry_8hpp.html#ae18601ba88bb34208da9e4a0f11fa983">DEBUG_MSG</a>(<span class="stringliteral">&quot;vertex&quot;</span>, <a class="code" href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">segment_t</a>(ringA[i],ringB[j]));</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                touchers.push_back( { <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a4c8372a94c69e5b0e1ebfa11b89a4ecf">TouchingPoint::VERTEX</a>, i, j });</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="namespacelibnfporb.html#a2e318553169d53a7150a00a79bd2762d">equals</a>(ringA[nextI], ringB[j]) &amp;&amp; bg::intersects(<a class="code" href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">segment_t</a>(ringA[i], ringA[nextI]), ringB[j])) {</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                <a class="code" href="geometry_8hpp.html#ae18601ba88bb34208da9e4a0f11fa983">DEBUG_MSG</a>(<span class="stringliteral">&quot;bona&quot;</span>, <a class="code" href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">segment_t</a>(ringA[i],ringB[j]));</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;                touchers.push_back( { <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a03f232c73ef66c6bf1850f06b9b35cd1">TouchingPoint::B_ON_A</a>, nextI, j });</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="namespacelibnfporb.html#a2e318553169d53a7150a00a79bd2762d">equals</a>(ringB[nextJ], ringA[i]) &amp;&amp; bg::intersects(<a class="code" href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">segment_t</a>(ringB[j], ringB[nextJ]), ringA[i])) {</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                <a class="code" href="geometry_8hpp.html#ae18601ba88bb34208da9e4a0f11fa983">DEBUG_MSG</a>(<span class="stringliteral">&quot;aonb&quot;</span>, <a class="code" href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">segment_t</a>(ringA[i],ringB[j]));</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                touchers.push_back( { <a class="code" href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5afc9b5dd72baef51ad1c3b7267d7424b5">TouchingPoint::A_ON_B</a>, i, nextJ });</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            }</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        }</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">return</span> touchers;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;}</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;}</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* SRC_ALGO_TOUCHING_POINT_HPP_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="ageometry_8hpp_html_ae18601ba88bb34208da9e4a0f11fa983"><div class="ttname"><a href="geometry_8hpp.html#ae18601ba88bb34208da9e4a0f11fa983">DEBUG_MSG</a></div><div class="ttdeci">#define DEBUG_MSG(title, value)</div><div class="ttdef"><b>Definition:</b> geometry.hpp:32</div></div>
<div class="ttc" id="anamespacelibnfporb_html"><div class="ttname"><a href="namespacelibnfporb.html">libnfporb</a></div><div class="ttdef"><b>Definition:</b> geometry.hpp:26</div></div>
<div class="ttc" id="anamespacelibnfporb_html_a2e318553169d53a7150a00a79bd2762d"><div class="ttname"><a href="namespacelibnfporb.html#a2e318553169d53a7150a00a79bd2762d">libnfporb::equals</a></div><div class="ttdeci">bool equals(const LongDouble &amp;lhs, const LongDouble &amp;rhs)</div><div class="ttdef"><b>Definition:</b> geometry.hpp:446</div></div>
<div class="ttc" id="anamespacelibnfporb_html_a56b264a84ae3c5f7e5c984e17ee89fbc"><div class="ttname"><a href="namespacelibnfporb.html#a56b264a84ae3c5f7e5c984e17ee89fbc">libnfporb::segment_t</a></div><div class="ttdeci">bg::model::segment&lt; point_t &gt; segment_t</div><div class="ttdef"><b>Definition:</b> geometry.hpp:355</div></div>
<div class="ttc" id="anamespacelibnfporb_html_a83ffffdc4e4235604aa207e82bbb4eab"><div class="ttname"><a href="namespacelibnfporb.html#a83ffffdc4e4235604aa207e82bbb4eab">libnfporb::psize_t</a></div><div class="ttdeci">polygon_t::ring_type::size_type psize_t</div><div class="ttdef"><b>Definition:</b> geometry.hpp:497</div></div>
<div class="ttc" id="anamespacelibnfporb_html_adef64d071f04a643db9eb39c7b12acb1"><div class="ttname"><a href="namespacelibnfporb.html#adef64d071f04a643db9eb39c7b12acb1">libnfporb::find_touching_points</a></div><div class="ttdeci">std::vector&lt; TouchingPoint &gt; find_touching_points(const polygon_t::ring_type &amp;ringA, const polygon_t::ring_type &amp;ringB)</div><div class="ttdoc">Search for touching points of two rings of A and B.</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:40</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html">libnfporb::TouchingPoint</a></div><div class="ttdef"><b>Definition:</b> touching_point.hpp:11</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_a75de8d3c56c6d69aa2ca36d642af1c27"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#a75de8d3c56c6d69aa2ca36d642af1c27">libnfporb::TouchingPoint::B_</a></div><div class="ttdeci">psize_t B_</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:31</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_aaade2069496c42a4f147cbf64f96c2b1"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#aaade2069496c42a4f147cbf64f96c2b1">libnfporb::TouchingPoint::type_</a></div><div class="ttdeci">Type type_</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:23</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_ac1374a2f822841422b7fd2379554d41f"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#ac1374a2f822841422b7fd2379554d41f">libnfporb::TouchingPoint::A_</a></div><div class="ttdeci">psize_t A_</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:27</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_afe317e8d33a5392facc07934748ae3f5"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5">libnfporb::TouchingPoint::Type</a></div><div class="ttdeci">Type</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:18</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_afe317e8d33a5392facc07934748ae3f5a03f232c73ef66c6bf1850f06b9b35cd1"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a03f232c73ef66c6bf1850f06b9b35cd1">libnfporb::TouchingPoint::B_ON_A</a></div><div class="ttdeci">@ B_ON_A</div><div class="ttdoc">B_ON_A.</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:21</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_afe317e8d33a5392facc07934748ae3f5a4c8372a94c69e5b0e1ebfa11b89a4ecf"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5a4c8372a94c69e5b0e1ebfa11b89a4ecf">libnfporb::TouchingPoint::VERTEX</a></div><div class="ttdeci">@ VERTEX</div><div class="ttdoc">VERTEX.</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:19</div></div>
<div class="ttc" id="astructlibnfporb_1_1TouchingPoint_html_afe317e8d33a5392facc07934748ae3f5afc9b5dd72baef51ad1c3b7267d7424b5"><div class="ttname"><a href="structlibnfporb_1_1TouchingPoint.html#afe317e8d33a5392facc07934748ae3f5afc9b5dd72baef51ad1c3b7267d7424b5">libnfporb::TouchingPoint::A_ON_B</a></div><div class="ttdeci">@ A_ON_B</div><div class="ttdoc">A_ON_B.</div><div class="ttdef"><b>Definition:</b> touching_point.hpp:20</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
