<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>area_provider: roi.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.8.17 -->
<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('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></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_c85d3e3c5052e9ad9ce18c6863244a25.html">lib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">roi.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="roi_8cpp.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;<span class="preprocessor">#include &quot;<a class="code" href="roi_8h.html">lib/roi.h</a>&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno"><a class="line" href="classroi.html#a701c27eee6123d5f7f6eb241d2924dc8">    3</a></span>&#160;<a class="code" href="classroi.html#a701c27eee6123d5f7f6eb241d2924dc8">roi::roi</a> (vector&lt;double&gt; x, vector&lt;double&gt; y)</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="comment">// equal number of x and y coordinates required</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;    <span class="keywordflow">if</span> (x.size() != y.size()) {</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;        ROS_ERROR(<span class="stringliteral">&quot;Cannot create ROI, number of x and y coordinates do not match (%lu != %lu)&quot;</span>, x.size(), y.size());</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;    }</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;    <span class="comment">// not enough coordinates</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x.size() &lt; 3) {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;        ROS_ERROR(<span class="stringliteral">&quot;Cannot create ROI, not enough coordinates: %lu&quot;</span>, x.size());</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    }</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;        <span class="comment">// set coordinates</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;x.size(); ++i) {</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;            <a class="code" href="classarea.html#aa8158ad7955107d6b43c44485a27b872">coords</a>[0].emplace(x[i], y[i]);</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        }</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;        <span class="comment">// convert global coordinates</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="classarea.html#a0eb55bca59864691f23b179e319884ec">global</a>)</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;            <a class="code" href="classarea.html#af2ad101e400c7e44534cd5960a56cb81">global_to_local</a>();</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        <span class="comment">// set origin</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <a class="code" href="classarea.html#a3d12a8eeed699c1d037e17ba76854f3c">set_origin</a>();</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    }</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <a class="code" href="classarea.html#a1e8293857d5b3cf324d7676893bcafbc">sort_coords</a>();</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;}</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="classroi.html#a51fccb70b14fa8a30ab5683c7d0cc089">   32</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="classroi.html#a51fccb70b14fa8a30ab5683c7d0cc089">roi::operator== </a>(<span class="keyword">const</span> <a class="code" href="classroi.html">roi</a> other)</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;{</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classarea.html#aa8158ad7955107d6b43c44485a27b872">coords</a>[0] == other.<a class="code" href="classarea.html#aa8158ad7955107d6b43c44485a27b872">coords</a>.at(0);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;}</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classroi.html#a838ad6b71454a1a44df9cc677ad8cf97">   37</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="classroi.html#a838ad6b71454a1a44df9cc677ad8cf97">roi::operator&lt; </a>(<span class="keyword">const</span> <a class="code" href="classroi.html">roi</a> other)<span class="keyword"> const</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classarea.html#aa8158ad7955107d6b43c44485a27b872">coords</a>.at(0) &lt; other.<a class="code" href="classarea.html#aa8158ad7955107d6b43c44485a27b872">coords</a>.at(0);</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassarea_html_aa8158ad7955107d6b43c44485a27b872"><div class="ttname"><a href="classarea.html#aa8158ad7955107d6b43c44485a27b872">area::coords</a></div><div class="ttdeci">map&lt; double, set&lt; pair&lt; double, double &gt; &gt; &gt; coords</div><div class="ttdoc">The coordinates of the area at different rotations.</div><div class="ttdef"><b>Definition:</b> <a href="area_8h_source.html#l00146">area.h:146</a></div></div>
<div class="ttc" id="aclassroi_html_a51fccb70b14fa8a30ab5683c7d0cc089"><div class="ttname"><a href="classroi.html#a51fccb70b14fa8a30ab5683c7d0cc089">roi::operator==</a></div><div class="ttdeci">bool operator==(const roi other)</div><div class="ttdoc">Compare two ROIs.</div><div class="ttdef"><b>Definition:</b> <a href="roi_8cpp_source.html#l00032">roi.cpp:32</a></div></div>
<div class="ttc" id="aclassarea_html_a1e8293857d5b3cf324d7676893bcafbc"><div class="ttname"><a href="classarea.html#a1e8293857d5b3cf324d7676893bcafbc">area::sort_coords</a></div><div class="ttdeci">void sort_coords()</div><div class="ttdoc">Sort the coordinates of the area counter-clockwise about the center by their angle [-π,...</div><div class="ttdef"><b>Definition:</b> <a href="area_8cpp_source.html#l00340">area.cpp:340</a></div></div>
<div class="ttc" id="aclassarea_html_af2ad101e400c7e44534cd5960a56cb81"><div class="ttname"><a href="classarea.html#af2ad101e400c7e44534cd5960a56cb81">area::global_to_local</a></div><div class="ttdeci">void global_to_local()</div><div class="ttdoc">Convert the coordinates of the area from global (GPS) coordinates to the local coordinate system.</div><div class="ttdef"><b>Definition:</b> <a href="area_8cpp_source.html#l00278">area.cpp:278</a></div></div>
<div class="ttc" id="aclassarea_html_a0eb55bca59864691f23b179e319884ec"><div class="ttname"><a href="classarea.html#a0eb55bca59864691f23b179e319884ec">area::global</a></div><div class="ttdeci">bool global</div><div class="ttdoc">Whether global (GPS) or local coordinates are used as source.</div><div class="ttdef"><b>Definition:</b> <a href="area_8h_source.html#l00151">area.h:151</a></div></div>
<div class="ttc" id="aclassroi_html_a838ad6b71454a1a44df9cc677ad8cf97"><div class="ttname"><a href="classroi.html#a838ad6b71454a1a44df9cc677ad8cf97">roi::operator&lt;</a></div><div class="ttdeci">bool operator&lt;(const roi other) const</div><div class="ttdoc">Compare two ROIs.</div><div class="ttdef"><b>Definition:</b> <a href="roi_8cpp_source.html#l00037">roi.cpp:37</a></div></div>
<div class="ttc" id="aclassroi_html_a701c27eee6123d5f7f6eb241d2924dc8"><div class="ttname"><a href="classroi.html#a701c27eee6123d5f7f6eb241d2924dc8">roi::roi</a></div><div class="ttdeci">roi(vector&lt; double &gt; x, vector&lt; double &gt; y)</div><div class="ttdoc">Constructor that initializes ROI coordinates.</div><div class="ttdef"><b>Definition:</b> <a href="roi_8cpp_source.html#l00003">roi.cpp:3</a></div></div>
<div class="ttc" id="aclassarea_html_a3d12a8eeed699c1d037e17ba76854f3c"><div class="ttname"><a href="classarea.html#a3d12a8eeed699c1d037e17ba76854f3c">area::set_origin</a></div><div class="ttdeci">void set_origin()</div><div class="ttdoc">Set the origin of the local coordinate system from the GPS starting position or given parameter.</div><div class="ttdef"><b>Definition:</b> <a href="area_8cpp_source.html#l00298">area.cpp:298</a></div></div>
<div class="ttc" id="aclassroi_html"><div class="ttname"><a href="classroi.html">roi</a></div><div class="ttdoc">A class that holds a region of interest (ROI).</div><div class="ttdef"><b>Definition:</b> <a href="roi_8h_source.html#l00009">roi.h:9</a></div></div>
<div class="ttc" id="aroi_8h_html"><div class="ttname"><a href="roi_8h.html">roi.h</a></div></div>

<br clear="all" />
<hr size="1"><div style="align: right;">
<a href="http://wiki.ros.org/area_provider">area_provider</a><br />
Author(s): Micha Sende <sende@lakeside-labs.com></br />
<small>autogenerated on Mon Jan 10 2022 15:13:45</small>
</div>
</body>
</html>
