<!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>CPointCloudColoured.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">CPointCloudColoured.h</div> </div> </div> <div class="contents"> <a href="_c_point_cloud_coloured_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 <a name="l00029"></a>00029 <span class="preprocessor">#ifndef opengl_CPointCloudColoured_H</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define opengl_CPointCloudColoured_H</span> <a name="l00031"></a>00031 <span class="preprocessor"></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="_c_renderizable_8h.html">mrpt/opengl/CRenderizable.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="_c_octree_point_renderer_8h.html">mrpt/opengl/COctreePointRenderer.h</a>></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="_p_l_y__import__export_8h.html">mrpt/utils/PLY_import_export.h</a>></span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="keyword">namespace </span>mrpt <a name="l00037"></a>00037 { <a name="l00038"></a>00038 <span class="keyword">namespace </span>opengl <a name="l00039"></a>00039 { <a name="l00040"></a><a class="code" href="namespacemrpt_1_1opengl.html#a78091e6f4ac885793402d201d1591b31">00040</a> <span class="keyword">class </span><a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html" title="A cloud of points, each one with an individual colour (R,G,B).">CPointCloudColoured</a>; <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">// This must be added to any CSerializable derived class:</span> <a name="l00043"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_ptr.html#a80db462c33eff700c1dfa63285104ea5">00043</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_point_cloud_coloured.html" title="A cloud of points, each one with an individual colour (R,G,B).">CPointCloudColoured</a>, <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>, <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> ) <a name="l00044"></a>00044 <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="comment">/** A cloud of points, each one with an individual colour (R,G,B). The alpha component is shared by all the points and is stored in the base member m_color_A.</span> <a name="l00047"></a>00047 <span class="comment"> *</span> <a name="l00048"></a>00048 <span class="comment"> * To load from a points-map, CPointCloudColoured::loadFromPointsMap().</span> <a name="l00049"></a>00049 <span class="comment"> *</span> <a name="l00050"></a>00050 <span class="comment"> * This class uses smart optimizations while rendering to efficiently draw clouds of millions of points,</span> <a name="l00051"></a>00051 <span class="comment"> * as described in this page: http://www.mrpt.org/Efficiently_rendering_point_clouds_of_millions_of_points</span> <a name="l00052"></a>00052 <span class="comment"> *</span> <a name="l00053"></a>00053 <span class="comment"> * \sa opengl::COpenGLScene, opengl::CPointCloud</span> <a name="l00054"></a>00054 <span class="comment"> *</span> <a name="l00055"></a>00055 <span class="comment"> * <div align="center"></span> <a name="l00056"></a>00056 <span class="comment"> * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;"></span> <a name="l00057"></a>00057 <span class="comment"> * <tr> <td> mrpt::opengl::CPointCloudColoured </td> <td> \image html preview_CPointCloudColoured.png </td> </tr></span> <a name="l00058"></a>00058 <span class="comment"> * </table></span> <a name="l00059"></a>00059 <span class="comment"> * </div></span> <a name="l00060"></a>00060 <span class="comment"> *</span> <a name="l00061"></a>00061 <span class="comment"> * \ingroup mrpt_opengl_grp</span> <a name="l00062"></a>00062 <span class="comment"> */</span> <a name="l00063"></a>00063 class <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html" title="A cloud of points, each one with an individual colour (R,G,B).">CPointCloudColoured</a> : <a name="l00064"></a>00064 public <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>, <a name="l00065"></a>00065 public <a class="code" href="classmrpt_1_1opengl_1_1_c_octree_point_renderer.html" title="Template class that implements the data structure and algorithms for Octree-based efficient rendering...">COctreePointRenderer</a><<a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html" title="A cloud of points, each one with an individual colour (R,G,B).">CPointCloudColoured</a>>, <a name="l00066"></a>00066 public mrpt::utils::<a class="code" href="classmrpt_1_1utils_1_1_p_l_y___importer.html" title="A virtual base class that implements the capability of importing 3D point clouds and faces from a fil...">PLY_Importer</a>, <a name="l00067"></a>00067 public mrpt::utils::<a class="code" href="classmrpt_1_1utils_1_1_p_l_y___exporter.html" title="A virtual base class that implements the capability of exporting 3D point clouds and faces to a file ...">PLY_Exporter</a> <a name="l00068"></a>00068 { <a name="l00069"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a4f28ec0d4233aa0e9488870429b3daa9">00069</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>( CPointCloudColoured ) <a name="l00070"></a>00070 <a name="l00071"></a>00071 public: <a name="l00072"></a>00072 struct <a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html">TPointColour</a> <a name="l00073"></a>00073 { <a name="l00074"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a0d45bf18193370435e2265a2e9458d95">00074</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a0d45bf18193370435e2265a2e9458d95">TPointColour</a>() { } <a name="l00075"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a6724b5a44641dea6d7d26179e28e28a6">00075</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a6724b5a44641dea6d7d26179e28e28a6">TPointColour</a>(<span class="keywordtype">float</span> _x,<span class="keywordtype">float</span> _y,<span class="keywordtype">float</span> _z,<span class="keywordtype">float</span> _R,<span class="keywordtype">float</span> _G,<span class="keywordtype">float</span> _B ) : x(_x),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(_y),z(_z),R(_R),G(_G),B(_B) { } <a name="l00076"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a07e6cd745df1c5ac34dde30fb9f3cf46">00076</a> <span class="keywordtype">float</span> x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,<a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html#a07e6cd745df1c5ac34dde30fb9f3cf46">z</a>,R,G,B; <span class="comment">// Float is precission enough for rendering</span> <a name="l00077"></a>00077 }; <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="keyword">private</span>: <a name="l00080"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a08a3bf5bc55bf17293d54a8a46b056ac">00080</a> <span class="keyword">typedef</span> std<a class="code" href="classstd_1_1vector.html">::vector<TPointColour></a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a08a3bf5bc55bf17293d54a8a46b056ac">TListPointColour</a>; <a name="l00081"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2b3f43836b94a1224538e197ca7f2601">00081</a> TListPointColour <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2b3f43836b94a1224538e197ca7f2601">m_points</a>; <a name="l00082"></a>00082 <a name="l00083"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ae6291f4cefea3b626cb7dc089ff336ba">00083</a> <span class="keyword">typedef</span> TListPointColour<a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ae6291f4cefea3b626cb7dc089ff336ba">::iterator</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ae6291f4cefea3b626cb7dc089ff336ba">iterator</a>; <a name="l00084"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2207cf33511475583d5c682f5769be9d">00084</a> <span class="keyword">typedef</span> TListPointColour<a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2207cf33511475583d5c682f5769be9d">::const_iterator</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2207cf33511475583d5c682f5769be9d">const_iterator</a>; <a name="l00085"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a0122a14747aee8ae00a038816acf46a6">00085</a> <span class="keyword">inline</span> iterator <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a0122a14747aee8ae00a038816acf46a6">begin</a>() { <span class="keywordflow">return</span> m_points.begin(); } <a name="l00086"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ab64e5202044a957c355bf2e808c59585">00086</a> <span class="keyword">inline</span> const_iterator <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ab64e5202044a957c355bf2e808c59585">begin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_points.begin(); } <a name="l00087"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a8ee2ec9653a22f94c736055d32fb548b">00087</a> <span class="keyword">inline</span> iterator <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a8ee2ec9653a22f94c736055d32fb548b">end</a>() { <span class="keywordflow">return</span> m_points.end(); } <a name="l00088"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2809ae4c24d1da0bc2056c8036d784df">00088</a> <span class="keyword">inline</span> const_iterator <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a2809ae4c24d1da0bc2056c8036d784df">end</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_points.end(); } <a name="l00089"></a>00089 <a name="l00090"></a>00090 <a name="l00091"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a4839a658c495b3fa04845691026a20e0">00091</a> <span class="keywordtype">float</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a4839a658c495b3fa04845691026a20e0" title="By default is 1.0.">m_pointSize</a>; <span class="comment">//!< By default is 1.0</span> <a name="l00092"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a744d170a977c1e7b148d2316ab0f9af6">00092</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a744d170a977c1e7b148d2316ab0f9af6" title="Default: false.">m_pointSmooth</a>; <span class="comment">//!< Default: false</span> <a name="l00093"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ad9ae2e85c9246ac6505ed12c76087c24">00093</a> <span class="comment"></span> <span class="keyword">mutable</span> <span class="keyword">volatile</span> <span class="keywordtype">size_t</span> m_last_rendered_count, <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ad9ae2e85c9246ac6505ed12c76087c24">m_last_rendered_count_ongoing</a>; <a name="l00094"></a>00094 <span class="comment"></span> <a name="l00095"></a>00095 <span class="comment"> /** Constructor</span> <a name="l00096"></a>00096 <span class="comment"> */</span> <a name="l00097"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a0649270daf3659873824c9d17aab3662">00097</a> <a class="code" href="namespacemrpt_1_1opengl.html#a78091e6f4ac885793402d201d1591b31">CPointCloudColoured</a>( ) : <a name="l00098"></a>00098 m_points(), <a name="l00099"></a>00099 m_pointSize(1), <a name="l00100"></a>00100 m_pointSmooth(false), <a name="l00101"></a>00101 m_last_rendered_count(0), <a name="l00102"></a>00102 m_last_rendered_count_ongoing(0) <a name="l00103"></a>00103 { <a name="l00104"></a>00104 }<span class="comment"></span> <a name="l00105"></a>00105 <span class="comment"> /** Private, virtual destructor: only can be deleted from smart pointers */</span> <a name="l00106"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a68248a600dc4022b9fdabf3111cef28a">00106</a> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a68248a600dc4022b9fdabf3111cef28a" title="Private, virtual destructor: only can be deleted from smart pointers.">~CPointCloudColoured</a>() { } <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="keywordtype">void</span> markAllPointsAsNew(); <span class="comment">//!< Do needed internal work if all points are new (octree rebuilt,...)</span> <a name="l00109"></a>00109 <span class="comment"></span> <a name="l00110"></a>00110 <span class="keyword">public</span>: <a name="l00111"></a>00111 <span class="comment"></span> <a name="l00112"></a>00112 <span class="comment"> /** @name Read/Write of the list of points to render</span> <a name="l00113"></a>00113 <span class="comment"> @{ */</span> <a name="l00114"></a>00114 <span class="comment"></span> <a name="l00115"></a>00115 <span class="comment"> /** Inserts a new point into the point cloud. */</span> <a name="l00116"></a>00116 <span class="keywordtype">void</span> <a class="code" href="eigen__plugins_8h.html#a9d57842d20d6813ae39cc88859d6f3c8" title="Insert an element at the end of the container (for 1D vectors/arrays)">push_back</a>(<span class="keywordtype">float</span> x,<span class="keywordtype">float</span> <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,<span class="keywordtype">float</span> z, <span class="keywordtype">float</span> R, <span class="keywordtype">float</span> G, <span class="keywordtype">float</span> B); <a name="l00117"></a>00117 <span class="comment"></span> <a name="l00118"></a>00118 <span class="comment"> /** Set the number of points, with undefined contents */</span> <a name="l00119"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a91e371ea37306c63b8e49d865af86a90">00119</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a91e371ea37306c63b8e49d865af86a90" title="Set the number of points, with undefined contents.">resize</a>(<span class="keywordtype">size_t</span> N) { m_points.resize(N); } <a name="l00120"></a>00120 <span class="comment"></span> <a name="l00121"></a>00121 <span class="comment"> /** Like STL std::vector's reserve */</span> <a name="l00122"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a653e25a82e0c31c91b4cea47ede2ca77">00122</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a653e25a82e0c31c91b4cea47ede2ca77" title="Like STL std::vector's reserve.">reserve</a>(<span class="keywordtype">size_t</span> N) { m_points.reserve(N); } <a name="l00123"></a>00123 <span class="comment"></span> <a name="l00124"></a>00124 <span class="comment"> /** Read access to each individual point (checks for "i" in the valid range only in Debug). */</span> <a name="l00125"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a07c5a22bcd1db15ec6e276dbbefa509e">00125</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html">TPointColour</a> &operator [](<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00126"></a>00126 <span class="preprocessor">#ifdef _DEBUG</span> <a name="l00127"></a>00127 <span class="preprocessor"></span> <a class="code" href="mrpt__macros_8h.html#a8b01938f6fbebe5c4163b7c83a137d1d">ASSERT_BELOW_</a>(i,<a class="code" href="namespacemrpt_1_1math.html#a632ae0aecf78103f87f18f9ac33f7170">size</a>()) <a name="l00128"></a>00128 <span class="preprocessor">#endif</span> <a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">return</span> m_points[i]; <a name="l00130"></a>00130 } <a name="l00131"></a>00131 <span class="comment"></span> <a name="l00132"></a>00132 <span class="comment"> /** Read access to each individual point (checks for "i" in the valid range only in Debug). */</span> <a name="l00133"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a45561d871188a2b98845de26546fc863">00133</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html">TPointColour</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a45561d871188a2b98845de26546fc863" title="Read access to each individual point (checks for "i" in the valid range only in Debug).">getPoint</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00134"></a>00134 <span class="preprocessor">#ifdef _DEBUG</span> <a name="l00135"></a>00135 <span class="preprocessor"></span> <a class="code" href="mrpt__macros_8h.html#a8b01938f6fbebe5c4163b7c83a137d1d">ASSERT_BELOW_</a>(i,<a class="code" href="namespacemrpt_1_1math.html#a632ae0aecf78103f87f18f9ac33f7170">size</a>()) <a name="l00136"></a>00136 <span class="preprocessor">#endif</span> <a name="l00137"></a>00137 <span class="preprocessor"></span> <span class="keywordflow">return</span> m_points[i]; <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <span class="comment"></span> <a name="l00140"></a>00140 <span class="comment"> /** Read access to each individual point (checks for "i" in the valid range only in Debug). */</span> <a name="l00141"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#aa8d84bdb29b9f5959546c1cfe9b5514a">00141</a> <span class="keyword">inline</span> mrpt<a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">::math::TPoint3Df</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#aa8d84bdb29b9f5959546c1cfe9b5514a" title="Read access to each individual point (checks for "i" in the valid range only in Debug).">getPointf</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00142"></a>00142 <span class="preprocessor">#ifdef _DEBUG</span> <a name="l00143"></a>00143 <span class="preprocessor"></span> <a class="code" href="mrpt__macros_8h.html#a8b01938f6fbebe5c4163b7c83a137d1d">ASSERT_BELOW_</a>(i,<a class="code" href="namespacemrpt_1_1math.html#a632ae0aecf78103f87f18f9ac33f7170">size</a>()) <a name="l00144"></a>00144 <span class="preprocessor">#endif</span> <a name="l00145"></a>00145 <span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">mrpt::math::TPoint3Df</a>(m_points[i].x,m_points[i].<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,m_points[i].z); <a name="l00146"></a>00146 } <a name="l00147"></a>00147 <span class="comment"></span> <a name="l00148"></a>00148 <span class="comment"> /** Write an individual point (checks for "i" in the valid range only in Debug). */</span> <a name="l00149"></a>00149 <span class="keywordtype">void</span> setPoint(<span class="keywordtype">size_t</span> i, <span class="keyword">const</span> TPointColour &p ); <a name="l00150"></a>00150 <a name="l00151"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a02d811527e44a28a496c0d90b11eb2ff">00151</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a02d811527e44a28a496c0d90b11eb2ff" title="Return the number of points.">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_points.size(); } <span class="comment">//!< Return the number of points</span> <a name="l00152"></a>00152 <span class="comment"></span> <a name="l00153"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a016677c9784d8945f741a0cb32feab35">00153</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a016677c9784d8945f741a0cb32feab35" title="Erase all the points.">clear</a>() { m_points.clear(); markAllPointsAsNew(); } <span class="comment">//!< Erase all the points</span> <a name="l00154"></a>00154 <span class="comment"></span> <a name="l00155"></a>00155 <span class="comment"></span> <a name="l00156"></a>00156 <span class="comment"> /** Load the points from a points map (passed as a pointer), depending on the type of point map passed: for the case of a mrpt::slam::CColouredPointMap the colours of individual points will be also copied.</span> <a name="l00157"></a>00157 <span class="comment"> * The possible classes accepted as arguments are: mrpt::slam::CColouredPointsMap, or in general any mrpt::slam::CPointsMap.</span> <a name="l00158"></a>00158 <span class="comment"> * \note The method is a template since CPointsMap belongs to a different mrpt library.</span> <a name="l00159"></a>00159 <span class="comment"> */</span> <a name="l00160"></a>00160 <span class="keyword">template</span> <<span class="keyword">class</span> POINTSMAP> <a name="l00161"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a9d1c7f3596632e50af06de42a87065ac">00161</a> <span class="keywordtype">void</span> loadFromPointsMap( <span class="keyword">const</span> POINTSMAP *m) <a name="l00162"></a>00162 { <a name="l00163"></a>00163 <span class="keywordflow">if</span> (m->hasColorPoints()) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 <span class="keywordtype">size_t</span> N = m->size(); <a name="l00166"></a>00166 m_points.resize(N); <a name="l00167"></a>00167 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<N;i++) <a name="l00168"></a>00168 { <a name="l00169"></a>00169 m->getPoint(i, <a name="l00170"></a>00170 m_points[i].x, <a name="l00171"></a>00171 m_points[i].<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>, <a name="l00172"></a>00172 m_points[i].z, <a name="l00173"></a>00173 m_points[i].R, <a name="l00174"></a>00174 m_points[i].G, <a name="l00175"></a>00175 m_points[i].B ); <a name="l00176"></a>00176 } <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <span class="keywordflow">else</span> <a name="l00179"></a>00179 { <a name="l00180"></a>00180 <span class="comment">// Default colors:</span> <a name="l00181"></a>00181 <a class="code" href="structmrpt_1_1dynamicsize__vector.html" title="The base class of MRPT vectors, actually, Eigen column matrices of dynamic size with specialized cons...">vector_float</a> xs,ys,zs; <a name="l00182"></a>00182 m->getAllPoints(xs,ys,zs); <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="keywordtype">size_t</span> N = xs.size(); <a name="l00185"></a>00185 m_points.resize(N); <a name="l00186"></a>00186 <span class="keyword">const</span> mrpt<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">::utils::TColorf</a> col(m_color); <a name="l00187"></a>00187 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<N;i++) <a name="l00188"></a>00188 { <a name="l00189"></a>00189 m_points[i].x = xs[i]; <a name="l00190"></a>00190 m_points[i].y = ys[i]; <a name="l00191"></a>00191 m_points[i].z = zs[i]; <a name="l00192"></a>00192 m_points[i].R = col.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#ac1941d15140c3f22cced86c45050aaef">R</a>; <a name="l00193"></a>00193 m_points[i].G = col.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#a49c6f1a9fe53f5d9618f9660fc19d498">G</a>; <a name="l00194"></a>00194 m_points[i].B = col.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#abd3067144a754d3bb08b786d7ce1757f">B</a>; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 } <a name="l00197"></a>00197 markAllPointsAsNew(); <a name="l00198"></a>00198 } <a name="l00199"></a>00199 <span class="comment"></span> <a name="l00200"></a>00200 <span class="comment"> /** Get the number of elements actually rendered in the last render event. */</span> <a name="l00201"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a10e9a8d9ba3ac45a0861c0d07e9488fb">00201</a> <span class="keywordtype">size_t</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a10e9a8d9ba3ac45a0861c0d07e9488fb" title="Get the number of elements actually rendered in the last render event.">getActuallyRendered</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_last_rendered_count; } <a name="l00202"></a>00202 <span class="comment"></span> <a name="l00203"></a>00203 <span class="comment"> /** @} */</span> <a name="l00204"></a>00204 <a name="l00205"></a>00205 <span class="comment"></span> <a name="l00206"></a>00206 <span class="comment"> /** @name Modify the appearance of the rendered points</span> <a name="l00207"></a>00207 <span class="comment"> @{ */</span> <a name="l00208"></a>00208 <a name="l00209"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ae83fb7aed217534a743bafc3cdaaafe3">00209</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#ae83fb7aed217534a743bafc3cdaaafe3">setPointSize</a>(<span class="keywordtype">float</span> pointSize) { m_pointSize = pointSize; } <a name="l00210"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a21c21a3aa44d2acfecbb11708b716024">00210</a> <span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a21c21a3aa44d2acfecbb11708b716024">getPointSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pointSize; } <a name="l00211"></a>00211 <a name="l00212"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a7894955a4135210a69d669f4bf7951c6">00212</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a7894955a4135210a69d669f4bf7951c6">enablePointSmooth</a>(<span class="keywordtype">bool</span> enable=<span class="keyword">true</span>) { m_pointSmooth=enable; } <a name="l00213"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a638b1873fecea52d59bfa5f57fd684df">00213</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a638b1873fecea52d59bfa5f57fd684df">disablePointSmooth</a>() { m_pointSmooth=<span class="keyword">false</span>; } <a name="l00214"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a0ee1c80180c36315c9b0b8d4d578b8a7">00214</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a0ee1c80180c36315c9b0b8d4d578b8a7">isPointSmoothEnabled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pointSmooth; } <a name="l00215"></a>00215 <span class="comment"></span> <a name="l00216"></a>00216 <span class="comment"> /** @} */</span> <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="comment"></span> <a name="l00219"></a>00219 <span class="comment"> /** Render */</span> <a name="l00220"></a>00220 <span class="keywordtype">void</span> render() <span class="keyword">const</span>; <a name="l00221"></a>00221 <span class="comment"></span> <a name="l00222"></a>00222 <span class="comment"> /** Render a subset of points (required by octree renderer) */</span> <a name="l00223"></a>00223 <span class="keywordtype">void</span> render_subset(<span class="keyword">const</span> <span class="keywordtype">bool</span> all, <span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<size_t></a>& idxs, <span class="keyword">const</span> <span class="keywordtype">float</span> render_area_sqpixels ) <span class="keyword">const</span>; <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="keyword">protected</span>:<span class="comment"></span> <a name="l00226"></a>00226 <span class="comment"> /** @name PLY Import virtual methods to implement in base classes</span> <a name="l00227"></a>00227 <span class="comment"> @{ */</span><span class="comment"></span> <a name="l00228"></a>00228 <span class="comment"> /** In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex */</span> <a name="l00229"></a>00229 <span class="keyword">virtual</span> <span class="keywordtype">void</span> PLY_import_set_vertex_count(<span class="keyword">const</span> <span class="keywordtype">size_t</span> N);<span class="comment"></span> <a name="l00230"></a>00230 <span class="comment"> /** In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face */</span> <a name="l00231"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a58c08dcdd2bfb622afd54764e5b11817">00231</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a58c08dcdd2bfb622afd54764e5b11817" title="In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face.">PLY_import_set_face_count</a>(<span class="keyword">const</span> <span class="keywordtype">size_t</span> N) { } <span class="comment"></span> <a name="l00232"></a>00232 <span class="comment"> /** In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point. </span> <a name="l00233"></a>00233 <span class="comment"> * \param pt_color Will be NULL if the loaded file does not provide color info.</span> <a name="l00234"></a>00234 <span class="comment"> */</span> <a name="l00235"></a>00235 <span class="keyword">virtual</span> <span class="keywordtype">void</span> PLY_import_set_vertex(<span class="keyword">const</span> <span class="keywordtype">size_t</span> idx, <span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">mrpt::math::TPoint3Df</a> &pt, <span class="keyword">const</span> <a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">mrpt::utils::TColorf</a> *pt_color = NULL);<span class="comment"></span> <a name="l00236"></a>00236 <span class="comment"> /** @} */</span> <a name="l00237"></a>00237 <span class="comment"></span> <a name="l00238"></a>00238 <span class="comment"> /** @name PLY Export virtual methods to implement in base classes</span> <a name="l00239"></a>00239 <span class="comment"> @{ */</span> <a name="l00240"></a>00240 <span class="comment"></span> <a name="l00241"></a>00241 <span class="comment"> /** In a base class, return the number of vertices */</span> <a name="l00242"></a>00242 <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> PLY_export_get_vertex_count() <span class="keyword">const</span>; <a name="l00243"></a>00243 <span class="comment"></span> <a name="l00244"></a>00244 <span class="comment"> /** In a base class, return the number of faces */</span> <a name="l00245"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a4a178f785a52da76b515af82e5f26e03">00245</a> <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_point_cloud_coloured.html#a4a178f785a52da76b515af82e5f26e03" title="In a base class, return the number of faces.">PLY_export_get_face_count</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 0; } <a name="l00246"></a>00246 <span class="comment"></span> <a name="l00247"></a>00247 <span class="comment"> /** In a base class, will be called after PLY_export_get_vertex_count() once for each exported point. </span> <a name="l00248"></a>00248 <span class="comment"> * \param pt_color Will be NULL if the loaded file does not provide color info.</span> <a name="l00249"></a>00249 <span class="comment"> */</span> <a name="l00250"></a>00250 <span class="keyword">virtual</span> <span class="keywordtype">void</span> PLY_export_get_vertex( <a name="l00251"></a>00251 <span class="keyword">const</span> <span class="keywordtype">size_t</span> idx, <a name="l00252"></a>00252 <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">mrpt::math::TPoint3Df</a> &pt, <a name="l00253"></a>00253 <span class="keywordtype">bool</span> &pt_has_color, <a name="l00254"></a>00254 <a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">mrpt::utils::TColorf</a> &pt_color) <span class="keyword">const</span>; <a name="l00255"></a>00255 <span class="comment"></span> <a name="l00256"></a>00256 <span class="comment"> /** @} */</span> <a name="l00257"></a>00257 <a name="l00258"></a>00258 <a name="l00259"></a>00259 }; <a name="l00260"></a>00260 <a name="l00261"></a>00261 <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> mrpt<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">::utils::CStream</a>& <a class="code" href="namespacemrpt_1_1opengl.html#a34eb2b27b17baf0675d3868913bc9d12">operator>></a>(<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">mrpt::utils::CStream</a>& in, CPointCloudColoured::TPointColour &o); <a name="l00262"></a>00262 <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> mrpt<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">::utils::CStream</a>& <a class="code" href="namespacemrpt_1_1opengl.html#a12e49154ca3af8dcb06d847404a0d4ea" title="Inserts an openGL object into a scene.">operator<<</a>(<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">mrpt::utils::CStream</a>& out, <span class="keyword">const</span> CPointCloudColoured::TPointColour &o); <a name="l00263"></a>00263 <a name="l00264"></a>00264 } <span class="comment">// end namespace</span> <a name="l00265"></a>00265 <a name="l00266"></a>00266 <span class="keyword">namespace </span>utils <a name="l00267"></a>00267 { <a name="l00268"></a>00268 <span class="keyword">using namespace </span>mrpt::opengl; <a name="l00269"></a>00269 <a name="l00270"></a>00270 <span class="comment">// Specialization must occur in the same namespace</span> <a name="l00271"></a>00271 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(<a class="code" href="structmrpt_1_1opengl_1_1_c_point_cloud_coloured_1_1_t_point_colour.html">CPointCloudColoured::TPointColour</a>) <a name="l00272"></a>00272 } <a name="l00273"></a>00273 <a name="l00274"></a>00274 } <span class="comment">// End of namespace</span> <a name="l00275"></a>00275 <a name="l00276"></a>00276 <a name="l00277"></a>00277 <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>