<!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>CAngularObservationMesh.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.7.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <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> <div id="MSearchBox" class="MSearchBoxInactive"> <div class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </div><div class="right"></div> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">CAngularObservationMesh.h</div> </div> </div> <div class="contents"> <a href="_c_angular_observation_mesh_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* +---------------------------------------------------------------------------+</span> <a name="l00002"></a>00002 <span class="comment"> | The Mobile Robot Programming Toolkit (MRPT) C++ library |</span> <a name="l00003"></a>00003 <span class="comment"> | |</span> <a name="l00004"></a>00004 <span class="comment"> | http://www.mrpt.org/ |</span> <a name="l00005"></a>00005 <span class="comment"> | |</span> <a name="l00006"></a>00006 <span class="comment"> | Copyright (C) 2005-2011 University of Malaga |</span> <a name="l00007"></a>00007 <span class="comment"> | |</span> <a name="l00008"></a>00008 <span class="comment"> | This software was written by the Machine Perception and Intelligent |</span> <a name="l00009"></a>00009 <span class="comment"> | Robotics Lab, University of Malaga (Spain). |</span> <a name="l00010"></a>00010 <span class="comment"> | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |</span> <a name="l00011"></a>00011 <span class="comment"> | |</span> <a name="l00012"></a>00012 <span class="comment"> | This file is part of the MRPT project. |</span> <a name="l00013"></a>00013 <span class="comment"> | |</span> <a name="l00014"></a>00014 <span class="comment"> | MRPT is free software: you can redistribute it and/or modify |</span> <a name="l00015"></a>00015 <span class="comment"> | it under the terms of the GNU General Public License as published by |</span> <a name="l00016"></a>00016 <span class="comment"> | the Free Software Foundation, either version 3 of the License, or |</span> <a name="l00017"></a>00017 <span class="comment"> | (at your option) any later version. |</span> <a name="l00018"></a>00018 <span class="comment"> | |</span> <a name="l00019"></a>00019 <span class="comment"> | MRPT is distributed in the hope that it will be useful, |</span> <a name="l00020"></a>00020 <span class="comment"> | but WITHOUT ANY WARRANTY; without even the implied warranty of |</span> <a name="l00021"></a>00021 <span class="comment"> | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |</span> <a name="l00022"></a>00022 <span class="comment"> | GNU General Public License for more details. |</span> <a name="l00023"></a>00023 <span class="comment"> | |</span> <a name="l00024"></a>00024 <span class="comment"> | You should have received a copy of the GNU General Public License |</span> <a name="l00025"></a>00025 <span class="comment"> | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |</span> <a name="l00026"></a>00026 <span class="comment"> | |</span> <a name="l00027"></a>00027 <span class="comment"> +---------------------------------------------------------------------------+ */</span> <a name="l00028"></a>00028 <span class="preprocessor">#ifndef opengl_CAngularObservationMesh_H</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define opengl_CAngularObservationMesh_H</span> <a name="l00030"></a>00030 <span class="preprocessor"></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <<a class="code" href="_c_renderizable_display_list_8h.html">mrpt/opengl/CRenderizableDisplayList.h</a>></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="_c_set_of_triangles_8h.html">mrpt/opengl/CSetOfTriangles.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="_c_matrix_template_8h.html">mrpt/math/CMatrixTemplate.h</a>></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="_c_matrix_b_8h.html">mrpt/math/CMatrixB.h</a>></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="stl__extensions_8h.html">mrpt/utils/stl_extensions.h</a>></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="_c_observation2_d_range_scan_8h.html">mrpt/slam/CObservation2DRangeScan.h</a>></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="_c_points_map_8h.html">mrpt/slam/CPointsMap.h</a>></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="_c_set_of_lines_8h.html">mrpt/opengl/CSetOfLines.h</a>></span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include <<a class="code" href="geometry_8h.html">mrpt/math/geometry.h</a>></span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="keyword">namespace </span>mrpt { <a name="l00043"></a>00043 <span class="keyword">namespace </span>opengl { <a name="l00044"></a>00044 <span class="keyword">using namespace </span>mrpt::utils; <a name="l00045"></a>00045 <span class="keyword">using namespace </span>mrpt::slam; <a name="l00046"></a>00046 <span class="keyword">using namespace </span>mrpt::poses; <a name="l00047"></a>00047 <a name="l00048"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_ptr.html#a488f526b12a71e4dd62ab164555c1368">00048</a> <a class="code" href="_c_serializable_8h.html#a9ef523d787f6cb837a0585b790882588" title="This declaration must be inserted in all CSerializable classes definition, before the class declarati...">DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE</a>(<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html" title="A mesh built from a set of 2D laser scan observations.">CAngularObservationMesh</a>,<a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable_display_list.html" title="A renderizable object suitable for rendering with OpenGL's display lists.">CRenderizableDisplayList</a>, <a class="code" href="maps_2include_2mrpt_2maps_2link__pragmas_8h.html#ad401479c152d92658375c646837e33ed">MAPS_IMPEXP</a>) <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="comment">/**</span> <a name="l00051"></a>00051 <span class="comment"> * A mesh built from a set of 2D laser scan observations.</span> <a name="l00052"></a>00052 <span class="comment"> * Each element of this set is a single scan through the yaw, given a specific pitch.</span> <a name="l00053"></a>00053 <span class="comment"> * Each scan has a CPose3D identifying the origin of the scan, which ideally is the</span> <a name="l00054"></a>00054 <span class="comment"> * same for every one of them.</span> <a name="l00055"></a>00055 <span class="comment"> * \ingroup mrpt_maps_grp</span> <a name="l00056"></a>00056 <span class="comment"> */</span> <a name="l00057"></a>00057 class <a class="code" href="maps_2include_2mrpt_2maps_2link__pragmas_8h.html#ad401479c152d92658375c646837e33ed">MAPS_IMPEXP</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html" title="A mesh built from a set of 2D laser scan observations.">CAngularObservationMesh</a>:public <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable_display_list.html" title="A renderizable object suitable for rendering with OpenGL's display lists.">CRenderizableDisplayList</a> { <a name="l00058"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a7cdc0526658fab817c16fe9b6aa4ec66">00058</a> <a class="code" href="_c_serializable_8h.html#a72ab55bf7ae009c89b75715cfa21e84d" title="This declaration must be inserted in all CSerializable classes definition, within the class declarati...">DEFINE_SERIALIZABLE</a>(<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html" title="A mesh built from a set of 2D laser scan observations.">CAngularObservationMesh</a>) <a name="l00059"></a>00059 public:<span class="comment"></span> <a name="l00060"></a>00060 <span class="comment"> /**</span> <a name="l00061"></a>00061 <span class="comment"> * Range specification type, with several uses.</span> <a name="l00062"></a>00062 <span class="comment"> */</span> <a name="l00063"></a>00063 struct <a class="code" href="maps_2include_2mrpt_2maps_2link__pragmas_8h.html#ad401479c152d92658375c646837e33ed">MAPS_IMPEXP</a> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">TDoubleRange</a> { <a name="l00064"></a>00064 <span class="keyword">private</span>:<span class="comment"></span> <a name="l00065"></a>00065 <span class="comment"> /**</span> <a name="l00066"></a>00066 <span class="comment"> * Range type. </span> <a name="l00067"></a>00067 <span class="comment"> * If 0, it's specified by an initial and a final value, and an increment.</span> <a name="l00068"></a>00068 <span class="comment"> * If 1, it's specified by an initial and a final value, and a fixed size of samples.</span> <a name="l00069"></a>00069 <span class="comment"> * If 2, it's specified by an aperture, a fixed size of samples and a boolean variable controlling direction. This type is always zero-centered.</span> <a name="l00070"></a>00070 <span class="comment"> */</span> <a name="l00071"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#ab7b22acc2b2c0acd8528e6604b4a42f3">00071</a> <span class="keywordtype">char</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#ab7b22acc2b2c0acd8528e6604b4a42f3" title="Range type.">rangeType</a>;<span class="comment"></span> <a name="l00072"></a>00072 <span class="comment"> /**</span> <a name="l00073"></a>00073 <span class="comment"> * Union type with the actual data.</span> <a name="l00074"></a>00074 <span class="comment"> * \sa rangeType</span> <a name="l00075"></a>00075 <span class="comment"> */</span> <a name="l00076"></a>00076 <span class="keyword">union </span><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html" title="Union type with the actual data.">rd</a> { <a name="l00077"></a>00077 <span class="keyword">struct </span>{ <a name="l00078"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a667b439e07163ffeaa0b1f77abbab79c">00078</a> <span class="keywordtype">double</span> <a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a667b439e07163ffeaa0b1f77abbab79c">initial</a>; <a name="l00079"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a28627f1b1ba9bac9687f60618a931c1b">00079</a> <span class="keywordtype">double</span> <span class="keyword">final</span>; <a name="l00080"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#abfd2cfaf3b0d6702702320c3130cd50b">00080</a> <span class="keywordtype">double</span> <a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#abfd2cfaf3b0d6702702320c3130cd50b">increment</a>; <a name="l00081"></a>00081 } mode0; <a name="l00082"></a>00082 <span class="keyword">struct </span>{ <a name="l00083"></a>00083 <span class="keywordtype">double</span> initial; <a name="l00084"></a>00084 <span class="keywordtype">double</span> <span class="keyword">final</span>; <a name="l00085"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a6f069f2d792965230941809983e74f46">00085</a> <span class="keywordtype">size_t</span> <a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a6f069f2d792965230941809983e74f46">amount</a>; <a name="l00086"></a>00086 } mode1; <a name="l00087"></a>00087 <span class="keyword">struct </span>{ <a name="l00088"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#af4d0ca835d43453bdea81e1daee4575c">00088</a> <span class="keywordtype">double</span> <a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#af4d0ca835d43453bdea81e1daee4575c">aperture</a>; <a name="l00089"></a>00089 <span class="keywordtype">size_t</span> amount; <a name="l00090"></a><a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a70c828aa71c0dfa6d40983c6e7831ba0">00090</a> <span class="keywordtype">bool</span> <a class="code" href="unionmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range_1_1rd.html#a70c828aa71c0dfa6d40983c6e7831ba0">negToPos</a>; <a name="l00091"></a>00091 } mode2; <a name="l00092"></a>00092 } rangeData;<span class="comment"></span> <a name="l00093"></a>00093 <span class="comment"> /**</span> <a name="l00094"></a>00094 <span class="comment"> * Constructor from initial value, final value and range.</span> <a name="l00095"></a>00095 <span class="comment"> */</span> <a name="l00096"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a5f9f5fc6fd70ed5a96c5d54c59dee5cd">00096</a> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a5f9f5fc6fd70ed5a96c5d54c59dee5cd" title="Constructor from initial value, final value and range.">TDoubleRange</a>(<span class="keywordtype">double</span> a,<span class="keywordtype">double</span> b,<span class="keywordtype">double</span> c):rangeType(0) { <a name="l00097"></a>00097 rangeData.mode0.initial=a; <a name="l00098"></a>00098 rangeData.mode0.final=b; <a name="l00099"></a>00099 rangeData.mode0.increment=c; <a name="l00100"></a>00100 }<span class="comment"></span> <a name="l00101"></a>00101 <span class="comment"> /**</span> <a name="l00102"></a>00102 <span class="comment"> * Constructor from initial value, final value and amount of samples.</span> <a name="l00103"></a>00103 <span class="comment"> */</span> <a name="l00104"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af720fd3520ed591acdd0472c9d350e34">00104</a> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af720fd3520ed591acdd0472c9d350e34" title="Constructor from initial value, final value and amount of samples.">TDoubleRange</a>(<span class="keywordtype">double</span> a,<span class="keywordtype">double</span> b,<span class="keywordtype">size_t</span> c):rangeType(1) { <a name="l00105"></a>00105 rangeData.mode1.initial=a; <a name="l00106"></a>00106 rangeData.mode1.final=b; <a name="l00107"></a>00107 rangeData.mode1.amount=c; <a name="l00108"></a>00108 }<span class="comment"></span> <a name="l00109"></a>00109 <span class="comment"> /**</span> <a name="l00110"></a>00110 <span class="comment"> * Constructor from aperture, amount of samples and scan direction.</span> <a name="l00111"></a>00111 <span class="comment"> */</span> <a name="l00112"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a150a9b1102273a48fe596e14ae92246d">00112</a> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a150a9b1102273a48fe596e14ae92246d" title="Constructor from aperture, amount of samples and scan direction.">TDoubleRange</a>(<span class="keywordtype">double</span> a,<span class="keywordtype">size_t</span> b,<span class="keywordtype">bool</span> c):rangeType(2) { <a name="l00113"></a>00113 rangeData.mode2.aperture=a; <a name="l00114"></a>00114 rangeData.mode2.amount=b; <a name="l00115"></a>00115 rangeData.mode2.negToPos=c; <a name="l00116"></a>00116 } <a name="l00117"></a>00117 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00118"></a>00118 <span class="comment"> /**</span> <a name="l00119"></a>00119 <span class="comment"> * Creates a range of values from the initial value, the final value and the increment.</span> <a name="l00120"></a>00120 <span class="comment"> * \throw std::logic_error if the increment is zero.</span> <a name="l00121"></a>00121 <span class="comment"> */</span> <a name="l00122"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a9a9148966433b1e31be5a538a0e79cde">00122</a> <span class="keyword">inline</span> <span class="keyword">static</span> TDoubleRange <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a9a9148966433b1e31be5a538a0e79cde" title="Creates a range of values from the initial value, the final value and the increment.">CreateFromIncrement</a>(<span class="keywordtype">double</span> initial,<span class="keywordtype">double</span> <span class="keyword">final</span>,<span class="keywordtype">double</span> increment) { <a name="l00123"></a>00123 <span class="keywordflow">if</span> (increment==0) <span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Invalid increment value."</span>); <a name="l00124"></a>00124 <span class="keywordflow">return</span> TDoubleRange(initial,<span class="keyword">final</span>,increment); <a name="l00125"></a>00125 }<span class="comment"></span> <a name="l00126"></a>00126 <span class="comment"> /**</span> <a name="l00127"></a>00127 <span class="comment"> * Creates a range of values from the initial value, the final value and a desired amount of samples.</span> <a name="l00128"></a>00128 <span class="comment"> */</span> <a name="l00129"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af5a876b32a010d47abf9bfdda740dee2">00129</a> <span class="keyword">inline</span> <span class="keyword">static</span> TDoubleRange <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af5a876b32a010d47abf9bfdda740dee2" title="Creates a range of values from the initial value, the final value and a desired amount of samples...">CreateFromAmount</a>(<span class="keywordtype">double</span> initial,<span class="keywordtype">double</span> <span class="keyword">final</span>,<span class="keywordtype">size_t</span> amount) { <a name="l00130"></a>00130 <span class="keywordflow">return</span> TDoubleRange(initial,<span class="keyword">final</span>,amount); <a name="l00131"></a>00131 }<span class="comment"></span> <a name="l00132"></a>00132 <span class="comment"> /**</span> <a name="l00133"></a>00133 <span class="comment"> * Creates a zero-centered range of values from an aperture, an amount of samples and a direction.</span> <a name="l00134"></a>00134 <span class="comment"> */</span> <a name="l00135"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a52f94f1da5c4dcdcd3c104e02ccfe542">00135</a> <span class="keyword">inline</span> <span class="keyword">static</span> TDoubleRange <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a52f94f1da5c4dcdcd3c104e02ccfe542" title="Creates a zero-centered range of values from an aperture, an amount of samples and a direction...">CreateFromAperture</a>(<span class="keywordtype">double</span> aperture,<span class="keywordtype">size_t</span> amount,<span class="keywordtype">bool</span> negToPos=<span class="keyword">true</span>) { <a name="l00136"></a>00136 <span class="keywordflow">return</span> TDoubleRange(aperture,amount,negToPos); <a name="l00137"></a>00137 }<span class="comment"></span> <a name="l00138"></a>00138 <span class="comment"> /**</span> <a name="l00139"></a>00139 <span class="comment"> * Returns the total aperture of the range.</span> <a name="l00140"></a>00140 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00141"></a>00141 <span class="comment"> */</span> <a name="l00142"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a5b71c6c681d8536dc3daa619652c643c">00142</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a5b71c6c681d8536dc3daa619652c643c" title="Returns the total aperture of the range.">aperture</a>()<span class="keyword"> const </span>{ <a name="l00143"></a>00143 <span class="keywordflow">switch</span> (rangeType) { <a name="l00144"></a>00144 <span class="keywordflow">case</span> 0:<span class="keywordflow">return</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.increment)==<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.final-rangeData.mode0.initial))?fabs(rangeData.mode0.final-rangeData.mode0.initial):0; <a name="l00145"></a>00145 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> rangeData.mode1.final-rangeData.mode1.initial; <a name="l00146"></a>00146 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.aperture; <a name="l00147"></a>00147 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00148"></a>00148 } <a name="l00149"></a>00149 }<span class="comment"></span> <a name="l00150"></a>00150 <span class="comment"> /**</span> <a name="l00151"></a>00151 <span class="comment"> * Returns the first value of the range.</span> <a name="l00152"></a>00152 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00153"></a>00153 <span class="comment"> */</span> <a name="l00154"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a4855b9322116206df4a12fc05d486621">00154</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a4855b9322116206df4a12fc05d486621" title="Returns the first value of the range.">initialValue</a>()<span class="keyword"> const </span>{ <a name="l00155"></a>00155 <span class="keywordflow">switch</span> (rangeType) { <a name="l00156"></a>00156 <span class="keywordflow">case</span> 0: <a name="l00157"></a>00157 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> rangeData.mode0.initial; <a name="l00158"></a>00158 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.negToPos?-rangeData.mode2.aperture/2:rangeData.mode2.aperture/2; <a name="l00159"></a>00159 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00160"></a>00160 } <a name="l00161"></a>00161 }<span class="comment"></span> <a name="l00162"></a>00162 <span class="comment"> /**</span> <a name="l00163"></a>00163 <span class="comment"> * Returns the last value of the range.</span> <a name="l00164"></a>00164 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00165"></a>00165 <span class="comment"> */</span> <a name="l00166"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#aa691b4d262560ea77564c862b18afc56">00166</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#aa691b4d262560ea77564c862b18afc56" title="Returns the last value of the range.">finalValue</a>()<span class="keyword"> const </span>{ <a name="l00167"></a>00167 <span class="keywordflow">switch</span> (rangeType) { <a name="l00168"></a>00168 <span class="keywordflow">case</span> 0:<span class="keywordflow">return</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.increment)==<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.final-rangeData.mode0.initial))?rangeData.mode0.final:rangeData.mode0.initial; <a name="l00169"></a>00169 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> rangeData.mode1.final; <a name="l00170"></a>00170 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.negToPos?rangeData.mode2.aperture/2:-rangeData.mode2.aperture/2; <a name="l00171"></a>00171 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00172"></a>00172 } <a name="l00173"></a>00173 }<span class="comment"></span> <a name="l00174"></a>00174 <span class="comment"> /**</span> <a name="l00175"></a>00175 <span class="comment"> * Returns the increment between two consecutive values of the range.</span> <a name="l00176"></a>00176 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00177"></a>00177 <span class="comment"> */</span> <a name="l00178"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a15a6c9ab9ea3686ec9f8309c630bd758">00178</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a15a6c9ab9ea3686ec9f8309c630bd758" title="Returns the increment between two consecutive values of the range.">increment</a>()<span class="keyword"> const </span>{ <a name="l00179"></a>00179 <span class="keywordflow">switch</span> (rangeType) { <a name="l00180"></a>00180 <span class="keywordflow">case</span> 0:<span class="keywordflow">return</span> rangeData.mode0.increment; <a name="l00181"></a>00181 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> (rangeData.mode1.final-rangeData.mode1.initial)/<span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(rangeData.mode1.amount-1); <a name="l00182"></a>00182 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.negToPos?rangeData.mode2.aperture/<span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(rangeData.mode2.amount-1):-rangeData.mode2.aperture/static_cast<double>(rangeData.mode2.amount-1); <a name="l00183"></a>00183 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 }<span class="comment"></span> <a name="l00186"></a>00186 <span class="comment"> /**</span> <a name="l00187"></a>00187 <span class="comment"> * Returns the total amount of values in this range.</span> <a name="l00188"></a>00188 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00189"></a>00189 <span class="comment"> */</span> <a name="l00190"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af9537b556c5873fa5f7acde1dafd9c3e">00190</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af9537b556c5873fa5f7acde1dafd9c3e" title="Returns the total amount of values in this range.">amount</a>()<span class="keyword"> const </span>{ <a name="l00191"></a>00191 <span class="keywordflow">switch</span> (rangeType) { <a name="l00192"></a>00192 <span class="keywordflow">case</span> 0:<span class="keywordflow">return</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.increment)==<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.final-rangeData.mode0.initial))?1+<span class="keyword">static_cast<</span><span class="keywordtype">size_t</span><span class="keyword">></span>(ceil((rangeData.mode0.final-rangeData.mode0.initial)/rangeData.mode0.increment)):1; <a name="l00193"></a>00193 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> rangeData.mode1.amount; <a name="l00194"></a>00194 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.amount; <a name="l00195"></a>00195 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00196"></a>00196 } <a name="l00197"></a>00197 }<span class="comment"></span> <a name="l00198"></a>00198 <span class="comment"> /**</span> <a name="l00199"></a>00199 <span class="comment"> * Gets a vector with every value in the range.</span> <a name="l00200"></a>00200 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00201"></a>00201 <span class="comment"> */</span> <a name="l00202"></a>00202 <span class="keywordtype">void</span> values(<a class="code" href="classstd_1_1vector.html">std::vector<double></a> &vals) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00203"></a>00203 <span class="comment"> /**</span> <a name="l00204"></a>00204 <span class="comment"> * Returns the direction of the scan. True if the increment is positive, false otherwise.</span> <a name="l00205"></a>00205 <span class="comment"> * \throw std::logic_error on invalid range type.</span> <a name="l00206"></a>00206 <span class="comment"> */</span> <a name="l00207"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a44b4206e4fcf88d55fb293d043eb96c9">00207</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a44b4206e4fcf88d55fb293d043eb96c9" title="Returns the direction of the scan.">negToPos</a>()<span class="keyword"> const </span>{ <a name="l00208"></a>00208 <span class="keywordflow">switch</span> (rangeType) { <a name="l00209"></a>00209 <span class="keywordflow">case</span> 0:<span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode0.increment)>0; <a name="l00210"></a>00210 <span class="keywordflow">case</span> 1:<span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(rangeData.mode1.final-rangeData.mode1.initial)>0; <a name="l00211"></a>00211 <span class="keywordflow">case</span> 2:<span class="keywordflow">return</span> rangeData.mode2.negToPos; <a name="l00212"></a>00212 <span class="keywordflow">default</span>:<span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Unknown range type."</span>); <a name="l00213"></a>00213 } <a name="l00214"></a>00214 } <a name="l00215"></a>00215 }; <a name="l00216"></a>00216 <span class="keyword">protected</span>:<span class="comment"></span> <a name="l00217"></a>00217 <span class="comment"> /**</span> <a name="l00218"></a>00218 <span class="comment"> * Updates the mesh, if needed. It's a const method, but modifies mutable content.</span> <a name="l00219"></a>00219 <span class="comment"> */</span> <a name="l00220"></a>00220 <span class="keywordtype">void</span> updateMesh() <span class="keyword">const</span>;<span class="comment"></span> <a name="l00221"></a>00221 <span class="comment"> /**</span> <a name="l00222"></a>00222 <span class="comment"> * Empty destructor.</span> <a name="l00223"></a>00223 <span class="comment"> */</span> <a name="l00224"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a907bfce35e7407b2395bf5a9cd5f76f6">00224</a> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a907bfce35e7407b2395bf5a9cd5f76f6" title="Empty destructor.">~CAngularObservationMesh</a>() {}<span class="comment"></span> <a name="l00225"></a>00225 <span class="comment"> /**</span> <a name="l00226"></a>00226 <span class="comment"> * Actual set of triangles to be displayed.</span> <a name="l00227"></a>00227 <span class="comment"> */</span> <a name="l00228"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a22008dc001cff062629f36250cdbbfb0">00228</a> <span class="keyword">mutable</span> std<a class="code" href="classstd_1_1vector.html">::vector<CSetOfTriangles::TTriangle></a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a22008dc001cff062629f36250cdbbfb0" title="Actual set of triangles to be displayed.">triangles</a>;<span class="comment"></span> <a name="l00229"></a>00229 <span class="comment"> /**</span> <a name="l00230"></a>00230 <span class="comment"> * Internal method to add a triangle to the mutable mesh.</span> <a name="l00231"></a>00231 <span class="comment"> */</span> <a name="l00232"></a>00232 <span class="keywordtype">void</span> addTriangle(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p2,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p3) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00233"></a>00233 <span class="comment"> /**</span> <a name="l00234"></a>00234 <span class="comment"> * Whether the mesh will be displayed wireframe or solid.</span> <a name="l00235"></a>00235 <span class="comment"> */</span> <a name="l00236"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a23fbbd0cb715174ba61713e3a3e128a9">00236</a> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a23fbbd0cb715174ba61713e3a3e128a9" title="Whether the mesh will be displayed wireframe or solid.">mWireframe</a>;<span class="comment"></span> <a name="l00237"></a>00237 <span class="comment"> /**</span> <a name="l00238"></a>00238 <span class="comment"> * Mutable variable which controls if the object has suffered any change since last time the mesh was updated.</span> <a name="l00239"></a>00239 <span class="comment"> */</span> <a name="l00240"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a68cbdb0edaa8b2d633e1b16b95276b5c">00240</a> <span class="keyword">mutable</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a68cbdb0edaa8b2d633e1b16b95276b5c" title="Mutable variable which controls if the object has suffered any change since last time the mesh was up...">meshUpToDate</a>;<span class="comment"></span> <a name="l00241"></a>00241 <span class="comment"> /**</span> <a name="l00242"></a>00242 <span class="comment"> * Whether the object may present transparencies or not.</span> <a name="l00243"></a>00243 <span class="comment"> */</span> <a name="l00244"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a9d201e4bc05326322cc47f691c19e0b8">00244</a> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a9d201e4bc05326322cc47f691c19e0b8" title="Whether the object may present transparencies or not.">mEnableTransparency</a>;<span class="comment"></span> <a name="l00245"></a>00245 <span class="comment"> /**</span> <a name="l00246"></a>00246 <span class="comment"> * Mutable object with the mesh's points.</span> <a name="l00247"></a>00247 <span class="comment"> */</span> <a name="l00248"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#afb451e1ac7a9ebbaa4d6078722848f1f">00248</a> <span class="keyword">mutable</span> mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_template.html">::math::CMatrixTemplate<TPoint3D></a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#afb451e1ac7a9ebbaa4d6078722848f1f" title="Mutable object with the mesh's points.">actualMesh</a>;<span class="comment"></span> <a name="l00249"></a>00249 <span class="comment"> /**</span> <a name="l00250"></a>00250 <span class="comment"> * Scan validity matrix.</span> <a name="l00251"></a>00251 <span class="comment"> */</span> <a name="l00252"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a108b7928b5b9b89012921134c3f290e3">00252</a> <span class="keyword">mutable</span> mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_b.html" title="This class is a "CSerializable" wrapper for "CMatrixBool".">::math::CMatrixB</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a108b7928b5b9b89012921134c3f290e3" title="Scan validity matrix.">validityMatrix</a>;<span class="comment"></span> <a name="l00253"></a>00253 <span class="comment"> /**</span> <a name="l00254"></a>00254 <span class="comment"> * Observation pitch range. When containing exactly two elements, they represent the bounds.</span> <a name="l00255"></a>00255 <span class="comment"> */</span> <a name="l00256"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ab025276dbf09f363484965d5d8f6f4a7">00256</a> std<a class="code" href="classstd_1_1vector.html">::vector<double></a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ab025276dbf09f363484965d5d8f6f4a7" title="Observation pitch range.">pitchBounds</a>;<span class="comment"></span> <a name="l00257"></a>00257 <span class="comment"> /**</span> <a name="l00258"></a>00258 <span class="comment"> * Actual scan set which is used to generate the mesh.</span> <a name="l00259"></a>00259 <span class="comment"> */</span> <a name="l00260"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ab4d45466342ad414d6b9d9c99f59dba4">00260</a> std<a class="code" href="classstd_1_1vector.html">::vector<CObservation2DRangeScan></a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ab4d45466342ad414d6b9d9c99f59dba4" title="Actual scan set which is used to generate the mesh.">scanSet</a>;<span class="comment"></span> <a name="l00261"></a>00261 <span class="comment"> /**</span> <a name="l00262"></a>00262 <span class="comment"> * Basic constructor.</span> <a name="l00263"></a>00263 <span class="comment"> */</span> <a name="l00264"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a0a0823294de6bb39fb9d87cce8c7467b">00264</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a0a0823294de6bb39fb9d87cce8c7467b" title="Basic constructor.">CAngularObservationMesh</a>():mWireframe(true),meshUpToDate(false),mEnableTransparency(true),actualMesh(0,0),validityMatrix(0,0),pitchBounds(),scanSet() {} <a name="l00265"></a>00265 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00266"></a>00266 <span class="comment"> /**</span> <a name="l00267"></a>00267 <span class="comment"> * Returns whether the object is configured as wireframe or solid.</span> <a name="l00268"></a>00268 <span class="comment"> */</span> <a name="l00269"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a92220af74bfc5ef11f80c160dfb870eb">00269</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a92220af74bfc5ef11f80c160dfb870eb" title="Returns whether the object is configured as wireframe or solid.">isWireframe</a>()<span class="keyword"> const </span>{ <a name="l00270"></a>00270 <span class="keywordflow">return</span> mWireframe; <a name="l00271"></a>00271 }<span class="comment"></span> <a name="l00272"></a>00272 <span class="comment"> /**</span> <a name="l00273"></a>00273 <span class="comment"> * Sets the display mode for the object. True=wireframe, False=solid.</span> <a name="l00274"></a>00274 <span class="comment"> */</span> <a name="l00275"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a5c6cac24a6baad08a00c46c4a82b51b2">00275</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a5c6cac24a6baad08a00c46c4a82b51b2" title="Sets the display mode for the object.">setWireframe</a>(<span class="keywordtype">bool</span> enabled=<span class="keyword">true</span>) { <a name="l00276"></a>00276 mWireframe=enabled; <a name="l00277"></a>00277 <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable_display_list.html#a77f8b97d7f4937b3f0777b76bc0ddf7a" title="Must be called to notify that the object has changed (so, the display list must be updated)...">CRenderizableDisplayList::notifyChange</a>(); <a name="l00278"></a>00278 }<span class="comment"></span> <a name="l00279"></a>00279 <span class="comment"> /**</span> <a name="l00280"></a>00280 <span class="comment"> * Returns whether the object may be transparent or not.</span> <a name="l00281"></a>00281 <span class="comment"> */</span> <a name="l00282"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a57432b0bba8b519c1b6495fc0fe59b4d">00282</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a57432b0bba8b519c1b6495fc0fe59b4d" title="Returns whether the object may be transparent or not.">isTransparencyEnabled</a>()<span class="keyword"> const </span>{ <a name="l00283"></a>00283 <span class="keywordflow">return</span> mEnableTransparency; <a name="l00284"></a>00284 }<span class="comment"></span> <a name="l00285"></a>00285 <span class="comment"> /**</span> <a name="l00286"></a>00286 <span class="comment"> * Enables or disables transparencies.</span> <a name="l00287"></a>00287 <span class="comment"> */</span> <a name="l00288"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#aea438c009a5e6ede59a6b45dd9a981d1">00288</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#aea438c009a5e6ede59a6b45dd9a981d1" title="Enables or disables transparencies.">enableTransparency</a>(<span class="keywordtype">bool</span> enabled=<span class="keyword">true</span>) { <a name="l00289"></a>00289 mEnableTransparency=enabled; <a name="l00290"></a>00290 <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable_display_list.html#a77f8b97d7f4937b3f0777b76bc0ddf7a" title="Must be called to notify that the object has changed (so, the display list must be updated)...">CRenderizableDisplayList::notifyChange</a>(); <a name="l00291"></a>00291 }<span class="comment"></span> <a name="l00292"></a>00292 <span class="comment"> /**</span> <a name="l00293"></a>00293 <span class="comment"> * Renderizes the object.</span> <a name="l00294"></a>00294 <span class="comment"> * \sa mrpt::opengl::CRenderizable</span> <a name="l00295"></a>00295 <span class="comment"> */</span> <a name="l00296"></a>00296 <span class="keyword">virtual</span> <span class="keywordtype">void</span> render_dl() <span class="keyword">const</span>;<span class="comment"></span> <a name="l00297"></a>00297 <span class="comment"> /**</span> <a name="l00298"></a>00298 <span class="comment"> * Traces a ray to the object, returning the distance to a given pose through its X axis.</span> <a name="l00299"></a>00299 <span class="comment"> * \sa mrpt::opengl::CRenderizable,trace2DSetOfRays,trace1DSetOfRays</span> <a name="l00300"></a>00300 <span class="comment"> */</span> <a name="l00301"></a>00301 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga363e00600f9c000dd774e6c721faba7d" title="Fast ray tracing method using polygons' properties.">traceRay</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">mrpt::poses::CPose3D</a> &o,<span class="keywordtype">double</span> &dist) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00302"></a>00302 <span class="comment"> /**</span> <a name="l00303"></a>00303 <span class="comment"> * Sets the pitch bounds for this range.</span> <a name="l00304"></a>00304 <span class="comment"> */</span> <a name="l00305"></a>00305 <span class="keywordtype">void</span> setPitchBounds(<span class="keyword">const</span> <span class="keywordtype">double</span> initial,<span class="keyword">const</span> <span class="keywordtype">double</span> <span class="keyword">final</span>);<span class="comment"></span> <a name="l00306"></a>00306 <span class="comment"> /**</span> <a name="l00307"></a>00307 <span class="comment"> * Sets the pitch bounds for this range.</span> <a name="l00308"></a>00308 <span class="comment"> */</span> <a name="l00309"></a>00309 <span class="keywordtype">void</span> setPitchBounds(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<double></a> bounds);<span class="comment"></span> <a name="l00310"></a>00310 <span class="comment"> /**</span> <a name="l00311"></a>00311 <span class="comment"> * Gets the initial and final pitch bounds for this range.</span> <a name="l00312"></a>00312 <span class="comment"> */</span> <a name="l00313"></a>00313 <span class="keywordtype">void</span> getPitchBounds(<span class="keywordtype">double</span> &initial,<span class="keywordtype">double</span> &<span class="keyword">final</span>) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00314"></a>00314 <span class="comment"> /**</span> <a name="l00315"></a>00315 <span class="comment"> * Gets the pitch bounds for this range.</span> <a name="l00316"></a>00316 <span class="comment"> */</span> <a name="l00317"></a>00317 <span class="keywordtype">void</span> getPitchBounds(<a class="code" href="classstd_1_1vector.html">std::vector<double></a> &bounds) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00318"></a>00318 <span class="comment"> /**</span> <a name="l00319"></a>00319 <span class="comment"> * Gets the scan set.</span> <a name="l00320"></a>00320 <span class="comment"> */</span> <a name="l00321"></a>00321 <span class="keywordtype">void</span> getScanSet(<a class="code" href="classstd_1_1vector.html">std::vector<CObservation2DRangeScan></a> &scans) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00322"></a>00322 <span class="comment"> /**</span> <a name="l00323"></a>00323 <span class="comment"> * Sets the scan set.</span> <a name="l00324"></a>00324 <span class="comment"> */</span> <a name="l00325"></a>00325 <span class="keywordtype">bool</span> setScanSet(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<CObservation2DRangeScan></a> &scans);<span class="comment"></span> <a name="l00326"></a>00326 <span class="comment"> /**</span> <a name="l00327"></a>00327 <span class="comment"> * Gets the mesh as a set of triangles, for displaying them.</span> <a name="l00328"></a>00328 <span class="comment"> * \sa generateSetOfTriangles(std::vector<TPolygon3D> &),mrpt::opengl::CSetOfTriangles,mrpt::opengl::CSetOfTriangles::TTriangle</span> <a name="l00329"></a>00329 <span class="comment"> */</span> <a name="l00330"></a>00330 <span class="keywordtype">void</span> generateSetOfTriangles(<a class="code" href="structmrpt_1_1opengl_1_1_c_set_of_triangles_ptr.html">CSetOfTrianglesPtr</a> &res) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00331"></a>00331 <span class="comment"> /**</span> <a name="l00332"></a>00332 <span class="comment"> * Returns the scanned points as a 3D point cloud. The target pointmap must be passed as a pointer to allow the use of any derived class.</span> <a name="l00333"></a>00333 <span class="comment"> */</span> <a name="l00334"></a>00334 <span class="keywordtype">void</span> generatePointCloud(<a class="code" href="classmrpt_1_1slam_1_1_c_points_map.html" title="A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...">CPointsMap</a> *out_map) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00335"></a>00335 <span class="comment"> /**</span> <a name="l00336"></a>00336 <span class="comment"> * Gets a set of lines containing the traced rays, for displaying them.</span> <a name="l00337"></a>00337 <span class="comment"> * \sa getUntracedRays,mrpt::opengl::CSetOfLines</span> <a name="l00338"></a>00338 <span class="comment"> */</span> <a name="l00339"></a>00339 <span class="keywordtype">void</span> getTracedRays(<a class="code" href="structmrpt_1_1opengl_1_1_c_set_of_lines_ptr.html">CSetOfLinesPtr</a> &res) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00340"></a>00340 <span class="comment"> /**</span> <a name="l00341"></a>00341 <span class="comment"> * Gets a set of lines containing the untraced rays, up to a specified distance, for displaying them.</span> <a name="l00342"></a>00342 <span class="comment"> * \sa getTracedRays,mrpt::opengl::CSetOfLines</span> <a name="l00343"></a>00343 <span class="comment"> */</span> <a name="l00344"></a>00344 <span class="keywordtype">void</span> getUntracedRays(<a class="code" href="structmrpt_1_1opengl_1_1_c_set_of_lines_ptr.html">CSetOfLinesPtr</a> &res,<span class="keywordtype">double</span> dist) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00345"></a>00345 <span class="comment"> /**</span> <a name="l00346"></a>00346 <span class="comment"> * Gets the mesh as a set of polygons, to work with them.</span> <a name="l00347"></a>00347 <span class="comment"> * \sa generateSetOfTriangles(mrpt::opengl::CSetOfTriangles &)</span> <a name="l00348"></a>00348 <span class="comment"> */</span> <a name="l00349"></a>00349 <span class="keywordtype">void</span> generateSetOfTriangles(<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &res) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00350"></a>00350 <span class="comment"> /**</span> <a name="l00351"></a>00351 <span class="comment"> * Retrieves the full mesh, along with the validity matrix.</span> <a name="l00352"></a>00352 <span class="comment"> */</span> <a name="l00353"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ae784e82dad4a7ee84f057fe2ef9b9b32">00353</a> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#ae784e82dad4a7ee84f057fe2ef9b9b32" title="Retrieves the full mesh, along with the validity matrix.">getActualMesh</a>(<a class="code" href="classmrpt_1_1math_1_1_c_matrix_template.html" title="This template class provides the basic functionality for a general 2D any-size, resizable container o...">mrpt::math::CMatrixTemplate<mrpt::math::TPoint3D></a> &pts,<a class="code" href="classmrpt_1_1math_1_1_c_matrix_template.html" title="This template class provides the basic functionality for a general 2D any-size, resizable container o...">mrpt::math::CMatrixBool</a> &validity)<span class="keyword"> const </span>{ <a name="l00354"></a>00354 <span class="keywordflow">if</span> (!meshUpToDate) updateMesh(); <a name="l00355"></a>00355 pts=actualMesh; <a name="l00356"></a>00356 validity=validityMatrix; <a name="l00357"></a>00357 } <a name="l00358"></a>00358 <span class="keyword">private</span>:<span class="comment"></span> <a name="l00359"></a>00359 <span class="comment"> /**</span> <a name="l00360"></a>00360 <span class="comment"> * Internal functor class to trace a ray.</span> <a name="l00361"></a>00361 <span class="comment"> */</span> <a name="l00362"></a>00362 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">class </span>FTrace1D { <a name="l00363"></a>00363 <span class="keyword">protected</span>: <a name="l00364"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ac1abbb36aee6328f0cb7bd5dc3f3ea39">00364</a> <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ac1abbb36aee6328f0cb7bd5dc3f3ea39">initial</a>; <a name="l00365"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#aed1d8270e90c99747c2afa28c934ecd5">00365</a> <span class="keyword">const</span> T &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#aed1d8270e90c99747c2afa28c934ecd5">e</a>; <a name="l00366"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ad50a933dcc81aadd843fe205a862df51">00366</a> std<a class="code" href="classstd_1_1vector.html">::vector<double></a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ad50a933dcc81aadd843fe205a862df51">values</a>; <a name="l00367"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#a24336175a55a9aa5aefedfe2da72aeb4">00367</a> std<a class="code" href="classstd_1_1vector.html">::vector<char></a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#a24336175a55a9aa5aefedfe2da72aeb4">valid</a>; <a name="l00368"></a>00368 <span class="keyword">public</span>: <a name="l00369"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#a402b28b5eb078ae6acbde008eef73e5a">00369</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#a402b28b5eb078ae6acbde008eef73e5a">FTrace1D</a>(<span class="keyword">const</span> T &s,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<a class="code" href="classstd_1_1vector.html">std::vector<double></a> &v,<a class="code" href="classstd_1_1vector.html">std::vector<char></a> &v2):initial(p),e(s),values(v),valid(v2) {} <a name="l00370"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ac30bafa2526e9a97eebb9003549509e1">00370</a> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html#ac30bafa2526e9a97eebb9003549509e1">operator()</a>(<span class="keywordtype">double</span> yaw) { <a name="l00371"></a>00371 <span class="keywordtype">double</span> dist; <a name="l00372"></a>00372 <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> pNew=initial+<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a>(0.0,0.0,0.0,yaw,0.0,0.0); <a name="l00373"></a>00373 <span class="keywordflow">if</span> (e->traceRay(pNew,dist)) { <a name="l00374"></a>00374 values.push_back(dist); <a name="l00375"></a>00375 valid.push_back(1); <a name="l00376"></a>00376 } <span class="keywordflow">else</span> { <a name="l00377"></a>00377 values.push_back(0); <a name="l00378"></a>00378 valid.push_back(0); <a name="l00379"></a>00379 } <a name="l00380"></a>00380 } <a name="l00381"></a>00381 };<span class="comment"></span> <a name="l00382"></a>00382 <span class="comment"> /**</span> <a name="l00383"></a>00383 <span class="comment"> * Internal functor class to trace a set of rays.</span> <a name="l00384"></a>00384 <span class="comment"> */</span> <a name="l00385"></a>00385 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">class </span>FTrace2D { <a name="l00386"></a>00386 <span class="keyword">protected</span>: <a name="l00387"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a4115a117127798bff81b66cce817511e">00387</a> <span class="keyword">const</span> T &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a4115a117127798bff81b66cce817511e">e</a>; <a name="l00388"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a9ceed108c1d44338767282035d1f1f5a">00388</a> <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a9ceed108c1d44338767282035d1f1f5a">initial</a>; <a name="l00389"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#af399f0b61c344fa7ad4364648ecea3e9">00389</a> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_ptr.html">CAngularObservationMeshPtr</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#af399f0b61c344fa7ad4364648ecea3e9">caom</a>; <a name="l00390"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#af50c22ab343cfd2694536343a776d0c6">00390</a> <span class="keyword">const</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html" title="A mesh built from a set of 2D laser scan observations.">CAngularObservationMesh</a><a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">::TDoubleRange</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#af50c22ab343cfd2694536343a776d0c6">yaws</a>; <a name="l00391"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a53d81f4fb740d41b154fd502d12153b0">00391</a> std<a class="code" href="classstd_1_1vector.html">::vector<CObservation2DRangeScan></a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a53d81f4fb740d41b154fd502d12153b0">vObs</a>; <a name="l00392"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a1eb516c9a94d1c268296fa341b373fe7">00392</a> <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#a1eb516c9a94d1c268296fa341b373fe7">pBase</a>; <a name="l00393"></a>00393 <span class="keyword">public</span>: <a name="l00394"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#acb6f1b2279b83798273eed23456d067a">00394</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#acb6f1b2279b83798273eed23456d067a">FTrace2D</a>(<span class="keyword">const</span> T &s,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_ptr.html">CAngularObservationMeshPtr</a> &om,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">CAngularObservationMesh::TDoubleRange</a> &<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,<a class="code" href="classstd_1_1vector.html">std::vector<CObservation2DRangeScan></a> &obs,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &b):e(s),initial(p),caom(om),yaws(y),vObs(obs),pBase(b) {} <a name="l00395"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#ae31c701794f80cbc016aeb88f3e1a5c2">00395</a> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html#ae31c701794f80cbc016aeb88f3e1a5c2">operator()</a>(<span class="keywordtype">double</span> pitch) { <a name="l00396"></a>00396 std<a class="code" href="classstd_1_1vector.html">::vector<double></a> yValues; <a name="l00397"></a>00397 yaws.values(yValues); <a name="l00398"></a>00398 <a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html" title="A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...">CObservation2DRangeScan</a> o=<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html" title="A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...">CObservation2DRangeScan</a>(); <a name="l00399"></a>00399 <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> pNew=initial+<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a>(0,0,0,0,pitch,0); <a name="l00400"></a>00400 std<a class="code" href="classstd_1_1vector.html">::vector<double></a> values; <a name="l00401"></a>00401 std<a class="code" href="classstd_1_1vector.html">::vector<char></a> valid; <a name="l00402"></a>00402 <span class="keywordtype">size_t</span> nY=yValues.size(); <a name="l00403"></a>00403 values.reserve(nY); <a name="l00404"></a>00404 valid.reserve(nY); <a name="l00405"></a>00405 for_each(yValues.begin(),yValues.end(),<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html" title="Internal functor class to trace a ray.">FTrace1D<T></a>(e,pNew,values,valid)); <a name="l00406"></a>00406 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#a3216654f8a7ca1794d07c7413543b65d" title="The aperture of the range finder, in radians (typically M_PI = 180 degrees).">aperture</a>=yaws.aperture(); <a name="l00407"></a>00407 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aeee9186fdaf0eaeebb9f0ded33f22fb5" title="The scanning direction.">rightToLeft</a>=yaws.negToPos(); <a name="l00408"></a>00408 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#afca19481225fa9b184a7abe3e6931904" title="The maximum range allowed by the device, in meters (e.g.">maxRange</a>=10000; <a name="l00409"></a>00409 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aaacc571bf0d8bf9d2c5b8739c7e6857b" title="The 6D pose of the sensor on the robot.">sensorPose</a>=pNew; <a name="l00410"></a>00410 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#a30ade452374508635ac800c7491ac498" title="If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...">deltaPitch</a>=0; <a name="l00411"></a>00411 <a class="code" href="group__stlext__grp.html#ga5263f98f648cdc32c1a74efc05d48d60" title="Copy all the elements in a container (vector, deque, list) into a different one performing the approp...">mrpt::utils::copy_container_typecasting</a>(values,o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aebc4a2fe346e299e632c732312b834e9" title="The range values of the scan, in meters.">scan</a>); <a name="l00412"></a>00412 o.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#ad75c2af475ada6103503511e90b965b7" title="It's false (=0) on no reflected rays, referenced to elements in "scan" (Added in the streamming versi...">validRange</a>=valid; <a name="l00413"></a>00413 vObs.push_back(o); <a name="l00414"></a>00414 } <a name="l00415"></a>00415 }; <a name="l00416"></a>00416 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00417"></a>00417 <span class="comment"> /**</span> <a name="l00418"></a>00418 <span class="comment"> * 2D ray tracing (will generate a 3D mesh). Given an object and two ranges, realizes a scan from the initial pose and stores it in a CAngularObservationMesh object.</span> <a name="l00419"></a>00419 <span class="comment"> * The objective may be a COpenGLScene, a CRenderizable or any children of its.</span> <a name="l00420"></a>00420 <span class="comment"> * \sa mrpt::opengl::CRenderizable,mrpt::opengl::COpenGLScene.</span> <a name="l00421"></a>00421 <span class="comment"> */</span> <a name="l00422"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a997561f11bbf9b0c3c407d0b01aebb84">00422</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#a997561f11bbf9b0c3c407d0b01aebb84" title="2D ray tracing (will generate a 3D mesh).">trace2DSetOfRays</a>(<span class="keyword">const</span> T &e,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &initial,<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_ptr.html">CAngularObservationMeshPtr</a> &caom,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">TDoubleRange</a> &pitchs,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">TDoubleRange</a> &yaws) { <a name="l00423"></a>00423 std<a class="code" href="classstd_1_1vector.html">::vector<double></a> pValues; <a name="l00424"></a>00424 pitchs.<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a2342d6c151a5778a907c3a48290701b5" title="Gets a vector with every value in the range.">values</a>(pValues); <a name="l00425"></a>00425 std<a class="code" href="classstd_1_1vector.html">::vector<CObservation2DRangeScan></a> vObs; <a name="l00426"></a>00426 vObs.reserve(pValues.size()); <a name="l00427"></a>00427 for_each(pValues.begin(),pValues.end(),<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace2_d.html" title="Internal functor class to trace a set of rays.">FTrace2D<T></a>(e,initial,caom,yaws,vObs,initial)); <a name="l00428"></a>00428 caom->mWireframe=<span class="keyword">false</span>; <a name="l00429"></a>00429 caom->mEnableTransparency=<span class="keyword">false</span>; <a name="l00430"></a>00430 caom->setPitchBounds(pValues); <a name="l00431"></a>00431 caom->setScanSet(vObs); <a name="l00432"></a>00432 }<span class="comment"></span> <a name="l00433"></a>00433 <span class="comment"> /**</span> <a name="l00434"></a>00434 <span class="comment"> * 2D ray tracing (will generate a vectorial mesh inside a plane). Given an object and a range, realizes a scan from the initial pose and stores it in a CObservation2DRangeScan object.</span> <a name="l00435"></a>00435 <span class="comment"> * The objective may be a COpenGLScene, a CRenderizable or any children of its.</span> <a name="l00436"></a>00436 <span class="comment"> * \sa mrpt::opengl::CRenderizable,mrpt::opengl::COpenGLScene.</span> <a name="l00437"></a>00437 <span class="comment"> */</span> <a name="l00438"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#adfb03a217d2d57c5de899a156057c31a">00438</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh.html#adfb03a217d2d57c5de899a156057c31a" title="2D ray tracing (will generate a vectorial mesh inside a plane).">trace1DSetOfRays</a>(<span class="keyword">const</span> T &e,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &initial,<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html" title="A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...">CObservation2DRangeScan</a> &obs,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html" title="Range specification type, with several uses.">TDoubleRange</a> &yaws) { <a name="l00439"></a>00439 std<a class="code" href="classstd_1_1vector.html">::vector<double></a> yValues; <a name="l00440"></a>00440 yaws.<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a2342d6c151a5778a907c3a48290701b5" title="Gets a vector with every value in the range.">values</a>(yValues); <a name="l00441"></a>00441 std<a class="code" href="classstd_1_1vector.html">::vector<double></a> scanValues; <a name="l00442"></a>00442 std<a class="code" href="classstd_1_1vector.html">::vector<char></a> valid; <a name="l00443"></a>00443 <span class="keywordtype">size_t</span> nV=yaws.<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#af9537b556c5873fa5f7acde1dafd9c3e" title="Returns the total amount of values in this range.">amount</a>(); <a name="l00444"></a>00444 scanValues.reserve(nV); <a name="l00445"></a>00445 valid.reserve(nV); <a name="l00446"></a>00446 for_each(yValues.begin(),yValues.end(),<a class="code" href="classmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_f_trace1_d.html" title="Internal functor class to trace a ray.">FTrace1D<T></a>(e,initial,scanValues,valid)); <a name="l00447"></a>00447 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#a3216654f8a7ca1794d07c7413543b65d" title="The aperture of the range finder, in radians (typically M_PI = 180 degrees).">aperture</a>=yaws.<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a5b71c6c681d8536dc3daa619652c643c" title="Returns the total aperture of the range.">aperture</a>(); <a name="l00448"></a>00448 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aeee9186fdaf0eaeebb9f0ded33f22fb5" title="The scanning direction.">rightToLeft</a>=yaws.<a class="code" href="structmrpt_1_1opengl_1_1_c_angular_observation_mesh_1_1_t_double_range.html#a44b4206e4fcf88d55fb293d043eb96c9" title="Returns the direction of the scan.">negToPos</a>(); <a name="l00449"></a>00449 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#afca19481225fa9b184a7abe3e6931904" title="The maximum range allowed by the device, in meters (e.g.">maxRange</a>=10000; <a name="l00450"></a>00450 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aaacc571bf0d8bf9d2c5b8739c7e6857b" title="The 6D pose of the sensor on the robot.">sensorPose</a>=initial; <a name="l00451"></a>00451 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#a30ade452374508635ac800c7491ac498" title="If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...">deltaPitch</a>=0; <a name="l00452"></a>00452 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#aebc4a2fe346e299e632c732312b834e9" title="The range values of the scan, in meters.">scan</a>=scanValues; <a name="l00453"></a>00453 obs.<a class="code" href="classmrpt_1_1slam_1_1_c_observation2_d_range_scan.html#ad75c2af475ada6103503511e90b965b7" title="It's false (=0) on no reflected rays, referenced to elements in "scan" (Added in the streamming versi...">validRange</a>=valid; <a name="l00454"></a>00454 } <a name="l00455"></a>00455 }; <a name="l00456"></a>00456 } <a name="l00457"></a>00457 } <a name="l00458"></a>00458 <span class="preprocessor">#endif</span> </pre></div></div> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>