<!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>lightweight_geom_data.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">lightweight_geom_data.h</div> </div> </div> <div class="contents"> <a href="lightweight__geom__data_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 LIGHTWEIGHT_GEOM_DATA_H</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define LIGHTWEIGHT_GEOM_DATA_H</span> <a name="l00030"></a>00030 <span class="preprocessor"></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <<a class="code" href="utils__defs_8h.html">mrpt/utils/utils_defs.h</a>></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="stl__extensions_8h.html">mrpt/utils/stl_extensions.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="_t_pixel_coord_8h.html">mrpt/utils/TPixelCoord.h</a>></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="math__frwds_8h.html">mrpt/math/math_frwds.h</a>></span> <span class="comment">// Fordward declarations</span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="keyword">namespace </span>mrpt { <a name="l00040"></a>00040 <span class="keyword">namespace </span>poses { <a name="l00041"></a>00041 <span class="keyword">template</span> <<span class="keyword">class</span> DERIVEDCLASS> <span class="keyword">class </span>CPoseOrPoint; <a name="l00042"></a>00042 <span class="keyword">class </span>CPoint2D; <a name="l00043"></a>00043 <span class="keyword">class </span>CPoint3D; <a name="l00044"></a>00044 <span class="keyword">class </span>CPose2D; <a name="l00045"></a>00045 <span class="keyword">class </span>CPose3D; <a name="l00046"></a>00046 } <a name="l00047"></a>00047 <span class="keyword">namespace </span>utils { <span class="keyword">class </span><a class="code" href="namespacemrpt_1_1utils.html#a4aa6d0388c837d159ca801e48d601449">CStream</a>; } <a name="l00048"></a>00048 } <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keyword">namespace </span>mrpt { <a name="l00051"></a>00051 <span class="keyword">namespace </span>math { <a name="l00052"></a>00052 <span class="keyword">using namespace </span>mrpt::utils; <span class="comment">// For "square"</span> <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">struct </span>TPoint2D; <a name="l00055"></a>00055 <span class="keyword">struct </span>TPose2D; <a name="l00056"></a>00056 <span class="keyword">struct </span>TPoint3D; <a name="l00057"></a>00057 <span class="keyword">struct </span>TPose3D; <a name="l00058"></a>00058 <span class="keyword">struct </span>TPose3DQuat; <a name="l00059"></a>00059 <span class="comment"></span> <a name="l00060"></a>00060 <span class="comment"> /** \addtogroup geometry_grp</span> <a name="l00061"></a>00061 <span class="comment"> * @{ */</span> <a name="l00062"></a>00062 <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="comment">//Pragma defined to ensure no structure packing</span> <a name="l00065"></a>00065 <span class="preprocessor">#pragma pack(push,1)</span> <a name="l00066"></a>00066 <span class="preprocessor"></span> <span class="comment">//Set of typedefs for lightweight geometric items.</span><span class="comment"></span> <a name="l00067"></a>00067 <span class="comment"> /**</span> <a name="l00068"></a>00068 <span class="comment"> * Lightweight 2D point. Allows coordinate access using [] operator.</span> <a name="l00069"></a>00069 <span class="comment"> * \sa mrpt::poses::CPoint2D</span> <a name="l00070"></a>00070 <span class="comment"> */</span> <a name="l00071"></a>00071 <span class="comment">//#define TOBJECTS_USE_UNIONS</span> <a name="l00072"></a>00072 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPoint2D {<span class="comment"></span> <a name="l00073"></a>00073 <span class="comment"> /**</span> <a name="l00074"></a>00074 <span class="comment"> * X coordinate.</span> <a name="l00075"></a>00075 <span class="comment"> */</span> <a name="l00076"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2">00076</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>;<span class="comment"></span> <a name="l00077"></a>00077 <span class="comment"> /**</span> <a name="l00078"></a>00078 <span class="comment"> * Y coordinate.</span> <a name="l00079"></a>00079 <span class="comment"> */</span> <a name="l00080"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf">00080</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>;<span class="comment"></span> <a name="l00081"></a>00081 <span class="comment"> /**</span> <a name="l00082"></a>00082 <span class="comment"> * Constructor from TPose2D, discarding phi.</span> <a name="l00083"></a>00083 <span class="comment"> * \sa TPose2D</span> <a name="l00084"></a>00084 <span class="comment"> */</span> <a name="l00085"></a>00085 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p);<span class="comment"></span> <a name="l00086"></a>00086 <span class="comment"> /**</span> <a name="l00087"></a>00087 <span class="comment"> * Constructor from TPoint3D, discarding z.</span> <a name="l00088"></a>00088 <span class="comment"> * \sa TPoint3D</span> <a name="l00089"></a>00089 <span class="comment"> */</span> <a name="l00090"></a>00090 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p);<span class="comment"></span> <a name="l00091"></a>00091 <span class="comment"> /**</span> <a name="l00092"></a>00092 <span class="comment"> * Constructor from TPose3D, discarding z and the angular coordinates.</span> <a name="l00093"></a>00093 <span class="comment"> * \sa TPose3D</span> <a name="l00094"></a>00094 <span class="comment"> */</span> <a name="l00095"></a>00095 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p);<span class="comment"></span> <a name="l00096"></a>00096 <span class="comment"> /**</span> <a name="l00097"></a>00097 <span class="comment"> * Constructor from CPoseOrPoint, perhaps losing 3D information</span> <a name="l00098"></a>00098 <span class="comment"> * \sa CPoseOrPoint,CPoint3D,CPose2D,CPose3D</span> <a name="l00099"></a>00099 <span class="comment"> */</span> <a name="l00100"></a>00100 <span class="keyword">template</span> <<span class="keyword">class</span> DERIVEDCLASS> <a name="l00101"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a54614e75c1b9046a9fb8ad6c30fb7621">00101</a> <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a54614e75c1b9046a9fb8ad6c30fb7621" title="Constructor from CPoseOrPoint, perhaps losing 3D information.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose_or_point.html">mrpt::poses::CPoseOrPoint<DERIVEDCLASS></a> &p) :x(p.x()),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(p.<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>()) {} <a name="l00102"></a>00102 <span class="comment"></span> <a name="l00103"></a>00103 <span class="comment"> /** Implicit transformation constructor from TPixelCoordf */</span> <a name="l00104"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a4d2e542a00923a390fa232acb6a0acd8">00104</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a4d2e542a00923a390fa232acb6a0acd8" title="Implicit transformation constructor from TPixelCoordf.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1utils_1_1_t_pixel_coordf.html" title="A pair (x,y) of pixel coordinates (subpixel resolution).">mrpt::utils::TPixelCoordf</a> &p) :x(p.x),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(p.<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>) {} <a name="l00105"></a>00105 <span class="comment"></span> <a name="l00106"></a>00106 <span class="comment"> /** Implicit constructor from CPoint2D */</span> <a name="l00107"></a>00107 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_point2_d.html" title="A class used to store a 2D point.">mrpt::poses::CPoint2D</a> &p);<span class="comment"></span> <a name="l00108"></a>00108 <span class="comment"> /**</span> <a name="l00109"></a>00109 <span class="comment"> * Constructor from coordinates.</span> <a name="l00110"></a>00110 <span class="comment"> */</span> <a name="l00111"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a643c84e24b6d8017814e69eb7fcb5d7d">00111</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a643c84e24b6d8017814e69eb7fcb5d7d" title="Constructor from coordinates.">TPoint2D</a>(<span class="keywordtype">double</span> xx,<span class="keywordtype">double</span> yy):x(xx),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(yy) {}<span class="comment"></span> <a name="l00112"></a>00112 <span class="comment"> /**</span> <a name="l00113"></a>00113 <span class="comment"> * Default fast constructor. Initializes to garbage.</span> <a name="l00114"></a>00114 <span class="comment"> */</span> <a name="l00115"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#aff6118cf6c6c5bf73572ed982bbebcb8">00115</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#aff6118cf6c6c5bf73572ed982bbebcb8" title="Default fast constructor.">TPoint2D</a>() {}<span class="comment"></span> <a name="l00116"></a>00116 <span class="comment"> /**</span> <a name="l00117"></a>00117 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00118"></a>00118 <span class="comment"> */</span> <a name="l00119"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#ae03ee477f29491e1d3dc5adbf4a2f9e0">00119</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#ae03ee477f29491e1d3dc5adbf4a2f9e0" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00120"></a>00120 <span class="keywordflow">return</span> (&x)[i]; <a name="l00121"></a>00121 }<span class="comment"></span> <a name="l00122"></a>00122 <span class="comment"> /**</span> <a name="l00123"></a>00123 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00124"></a>00124 <span class="comment"> */</span> <a name="l00125"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1772f5c95c86736dc92a9c1987d352f4">00125</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1772f5c95c86736dc92a9c1987d352f4" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00126"></a>00126 <span class="keywordflow">return</span> (&x)[i]; <a name="l00127"></a>00127 }<span class="comment"></span> <a name="l00128"></a>00128 <span class="comment"> /**</span> <a name="l00129"></a>00129 <span class="comment"> * Transformation into vector.</span> <a name="l00130"></a>00130 <span class="comment"> */</span> <a name="l00131"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#aca273276a6b5238ecc0807dc090dab33">00131</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#aca273276a6b5238ecc0807dc090dab33" title="Transformation into vector.">getAsVector</a>(<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_double</a> &v)<span class="keyword"> const </span>{ <a name="l00132"></a>00132 v.<a class="code" href="structmrpt_1_1dynamicsize__vector.html#a8fd6a8b950613c9abbf6366bcc9d4e4c" title="Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...">resize</a>(2); <a name="l00133"></a>00133 v[0]=x; v[1]=<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>; <a name="l00134"></a>00134 } <a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a8ad7d758a7e626faf788eeef3ff417cd">operator<</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) <span class="keyword">const</span>; <a name="l00137"></a>00137 <a name="l00138"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#af2502ef39b3babc39fed9b188da29c5f">00138</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#af2502ef39b3babc39fed9b188da29c5f">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) { <a name="l00139"></a>00139 x+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>; <a name="l00140"></a>00140 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>; <a name="l00141"></a>00141 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00142"></a>00142 } <a name="l00143"></a>00143 <a name="l00144"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a31c145beff6becf7b5f17af60138c7e5">00144</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a31c145beff6becf7b5f17af60138c7e5">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) { <a name="l00145"></a>00145 x-=p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>; <a name="l00146"></a>00146 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>-=p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>; <a name="l00147"></a>00147 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00148"></a>00148 } <a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a29064b0786d89ac0e78ff472564af100">00150</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a29064b0786d89ac0e78ff472564af100">operator*=</a>(<span class="keywordtype">double</span> d) { <a name="l00151"></a>00151 x*=d; <a name="l00152"></a>00152 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>*=d; <a name="l00153"></a>00153 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00154"></a>00154 } <a name="l00155"></a>00155 <a name="l00156"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a5075e6eba41d259f1826892501cee7ac">00156</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a5075e6eba41d259f1826892501cee7ac">operator/=</a>(<span class="keywordtype">double</span> d) { <a name="l00157"></a>00157 x/=d; <a name="l00158"></a>00158 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>/=d; <a name="l00159"></a>00159 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <a name="l00162"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1a39a1f7bcbd14ccf8cb5c48ee13de2a">00162</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1a39a1f7bcbd14ccf8cb5c48ee13de2a">operator+</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p)<span class="keyword"> const </span>{ <a name="l00163"></a>00163 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> r(*<span class="keyword">this</span>); <a name="l00164"></a>00164 <span class="keywordflow">return</span> r+=p; <a name="l00165"></a>00165 } <a name="l00166"></a>00166 <a name="l00167"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a8a5470aee867e30fbb80c3f0a6f4c0c8">00167</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a8a5470aee867e30fbb80c3f0a6f4c0c8">operator-</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p)<span class="keyword"> const </span>{ <a name="l00168"></a>00168 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> r(*<span class="keyword">this</span>); <a name="l00169"></a>00169 <span class="keywordflow">return</span> r-=p; <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#abeaa77cd9651e00c07ada002e5a0806b">00172</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#abeaa77cd9651e00c07ada002e5a0806b">operator*</a>(<span class="keywordtype">double</span> d)<span class="keyword"> const </span>{ <a name="l00173"></a>00173 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> r(*<span class="keyword">this</span>); <a name="l00174"></a>00174 <span class="keywordflow">return</span> r*=d; <a name="l00175"></a>00175 } <a name="l00176"></a>00176 <a name="l00177"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a40709135521a62f6c6806f28166f1149">00177</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a40709135521a62f6c6806f28166f1149">operator/</a>(<span class="keywordtype">double</span> d)<span class="keyword"> const </span>{ <a name="l00178"></a>00178 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> r(*<span class="keyword">this</span>); <a name="l00179"></a>00179 <span class="keywordflow">return</span> r/=d; <a name="l00180"></a>00180 }<span class="comment"></span> <a name="l00181"></a>00181 <span class="comment"> /** Returns a human-readable textual representation of the object (eg: "[0.02 1.04]" )</span> <a name="l00182"></a>00182 <span class="comment"> * \sa fromString</span> <a name="l00183"></a>00183 <span class="comment"> */</span> <a name="l00184"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1d0440b33bea68b4c2fd42eaee72e7c9">00184</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1d0440b33bea68b4c2fd42eaee72e7c9" title="Returns a human-readable textual representation of the object (eg: "[0.02 1.04]" )">asString</a>(<a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s)<span class="keyword"> const </span>{ s = <a class="code" href="namespacemrpt.html#a3a27af794b658df5491e2b7678f8ccb8" title="A std::string version of C sprintf.">mrpt::format</a>(<span class="stringliteral">"[%f %f]"</span>,x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>); } <a name="l00185"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a102f3c104b0a154c7eab7f49f86d58b2">00185</a> <span class="keyword">inline</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a102f3c104b0a154c7eab7f49f86d58b2">asString</a>()<span class="keyword"> const </span>{ std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> s; <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a102f3c104b0a154c7eab7f49f86d58b2">asString</a>(s); <span class="keywordflow">return</span> s; } <a name="l00186"></a>00186 <span class="comment"></span> <a name="l00187"></a>00187 <span class="comment"> /** Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" )</span> <a name="l00188"></a>00188 <span class="comment"> * \sa asString</span> <a name="l00189"></a>00189 <span class="comment"> * \exception std::exception On invalid format</span> <a name="l00190"></a>00190 <span class="comment"> */</span> <a name="l00191"></a>00191 <span class="keywordtype">void</span> fromString(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s); <a name="l00192"></a><a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a831c64888bbaa386899385159bfebfac">00192</a> <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a831c64888bbaa386899385159bfebfac">size</a>() { <span class="keywordflow">return</span> 2; } <a name="l00193"></a>00193 }; <a name="l00194"></a>00194 <span class="comment"></span> <a name="l00195"></a>00195 <span class="comment"> /**</span> <a name="l00196"></a>00196 <span class="comment"> * Lightweight 2D pose. Allows coordinate access using [] operator.</span> <a name="l00197"></a>00197 <span class="comment"> * \sa mrpt::poses::CPose2D</span> <a name="l00198"></a>00198 <span class="comment"> */</span> <a name="l00199"></a>00199 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPose2D {<span class="comment"></span> <a name="l00200"></a>00200 <span class="comment"> /**</span> <a name="l00201"></a>00201 <span class="comment"> * X coordinate.</span> <a name="l00202"></a>00202 <span class="comment"> */</span> <a name="l00203"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264">00203</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264" title="X coordinate.">x</a>;<span class="comment"></span> <a name="l00204"></a>00204 <span class="comment"> /**</span> <a name="l00205"></a>00205 <span class="comment"> * Y coordinate.</span> <a name="l00206"></a>00206 <span class="comment"> */</span> <a name="l00207"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387">00207</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387" title="Y coordinate.">y</a>;<span class="comment"></span> <a name="l00208"></a>00208 <span class="comment"> /**</span> <a name="l00209"></a>00209 <span class="comment"> * Phi coordinate.</span> <a name="l00210"></a>00210 <span class="comment"> */</span> <a name="l00211"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f">00211</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f" title="Phi coordinate.">phi</a>;<span class="comment"></span> <a name="l00212"></a>00212 <span class="comment"> /**</span> <a name="l00213"></a>00213 <span class="comment"> * Implicit constructor from TPoint2D. Zeroes the phi coordinate.</span> <a name="l00214"></a>00214 <span class="comment"> * \sa TPoint2D</span> <a name="l00215"></a>00215 <span class="comment"> */</span> <a name="l00216"></a>00216 <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p);<span class="comment"></span> <a name="l00217"></a>00217 <span class="comment"> /**</span> <a name="l00218"></a>00218 <span class="comment"> * Constructor from TPoint3D, losing information. Zeroes the phi coordinate.</span> <a name="l00219"></a>00219 <span class="comment"> * \sa TPoint3D</span> <a name="l00220"></a>00220 <span class="comment"> */</span> <a name="l00221"></a>00221 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p);<span class="comment"></span> <a name="l00222"></a>00222 <span class="comment"> /**</span> <a name="l00223"></a>00223 <span class="comment"> * Constructor from TPose3D, losing information. The phi corresponds to the original pose's yaw.</span> <a name="l00224"></a>00224 <span class="comment"> * \sa TPose3D</span> <a name="l00225"></a>00225 <span class="comment"> */</span> <a name="l00226"></a>00226 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p);<span class="comment"></span> <a name="l00227"></a>00227 <span class="comment"> /**</span> <a name="l00228"></a>00228 <span class="comment"> * Implicit constructor from heavyweight type.</span> <a name="l00229"></a>00229 <span class="comment"> * \sa mrpt::poses::CPose2D</span> <a name="l00230"></a>00230 <span class="comment"> */</span> <a name="l00231"></a>00231 <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">mrpt::poses::CPose2D</a> &p);<span class="comment"></span> <a name="l00232"></a>00232 <span class="comment"> /**</span> <a name="l00233"></a>00233 <span class="comment"> * Constructor from coordinates.</span> <a name="l00234"></a>00234 <span class="comment"> */</span> <a name="l00235"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a7cf4288dbb925e73fa8d189878f20880">00235</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a7cf4288dbb925e73fa8d189878f20880" title="Constructor from coordinates.">TPose2D</a>(<span class="keywordtype">double</span> xx,<span class="keywordtype">double</span> yy,<span class="keywordtype">double</span> pphi):x(xx),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(yy),phi(pphi) {}<span class="comment"></span> <a name="l00236"></a>00236 <span class="comment"> /**</span> <a name="l00237"></a>00237 <span class="comment"> * Default fast constructor. Initializes to garbage.</span> <a name="l00238"></a>00238 <span class="comment"> */</span> <a name="l00239"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a9d5625023ed51c2e26e0e9352565dff9">00239</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a9d5625023ed51c2e26e0e9352565dff9" title="Default fast constructor.">TPose2D</a>() {}<span class="comment"></span> <a name="l00240"></a>00240 <span class="comment"> /**</span> <a name="l00241"></a>00241 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00242"></a>00242 <span class="comment"> */</span> <a name="l00243"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a905d3bee7a8d479f7ff38ace9b69d4bc">00243</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a905d3bee7a8d479f7ff38ace9b69d4bc" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00244"></a>00244 <span class="keywordflow">return</span> (&x)[i]; <a name="l00245"></a>00245 }<span class="comment"></span> <a name="l00246"></a>00246 <span class="comment"> /**</span> <a name="l00247"></a>00247 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00248"></a>00248 <span class="comment"> */</span> <a name="l00249"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#ac060be44841bf8ec72cefbc26b74f8de">00249</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#ac060be44841bf8ec72cefbc26b74f8de" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00250"></a>00250 <span class="keywordflow">return</span> (&x)[i]; <a name="l00251"></a>00251 }<span class="comment"></span> <a name="l00252"></a>00252 <span class="comment"> /**</span> <a name="l00253"></a>00253 <span class="comment"> * Transformation into vector.</span> <a name="l00254"></a>00254 <span class="comment"> */</span> <a name="l00255"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#ab1e496cda32ac32a5ac717b605cc7779">00255</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#ab1e496cda32ac32a5ac717b605cc7779" title="Transformation into vector.">getAsVector</a>(<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_double</a> &v)<span class="keyword"> const </span>{ <a name="l00256"></a>00256 v.<a class="code" href="structmrpt_1_1dynamicsize__vector.html#a8fd6a8b950613c9abbf6366bcc9d4e4c" title="Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...">resize</a>(3); <a name="l00257"></a>00257 v[0]=x; v[1]=<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>; v[2]=phi; <a name="l00258"></a>00258 }<span class="comment"></span> <a name="l00259"></a>00259 <span class="comment"> /** Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees)</span> <a name="l00260"></a>00260 <span class="comment"> * \sa fromString</span> <a name="l00261"></a>00261 <span class="comment"> */</span> <a name="l00262"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a288db131182a6011dcfd4f2e6b95c0bd">00262</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a288db131182a6011dcfd4f2e6b95c0bd" title="Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees)...">asString</a>(<a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s)<span class="keyword"> const </span>{ s = <a class="code" href="namespacemrpt.html#a3a27af794b658df5491e2b7678f8ccb8" title="A std::string version of C sprintf.">mrpt::format</a>(<span class="stringliteral">"[%f %f %f]"</span>,x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,<a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">RAD2DEG</a>(phi)); } <a name="l00263"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a9276ecc691b4f74b6beabb089134ac47">00263</a> <span class="keyword">inline</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a9276ecc691b4f74b6beabb089134ac47">asString</a>()<span class="keyword"> const </span>{ std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> s; <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a9276ecc691b4f74b6beabb089134ac47">asString</a>(s); <span class="keywordflow">return</span> s; } <a name="l00264"></a>00264 <span class="comment"></span> <a name="l00265"></a>00265 <span class="comment"> /** Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -45.0]" )</span> <a name="l00266"></a>00266 <span class="comment"> * \sa asString</span> <a name="l00267"></a>00267 <span class="comment"> * \exception std::exception On invalid format</span> <a name="l00268"></a>00268 <span class="comment"> */</span> <a name="l00269"></a>00269 <span class="keywordtype">void</span> fromString(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s); <a name="l00270"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a045131544151d6bbac29b76ade0fe642">00270</a> <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a045131544151d6bbac29b76ade0fe642">size</a>() { <span class="keywordflow">return</span> 3; } <a name="l00271"></a>00271 }; <a name="l00272"></a>00272 <span class="comment"></span> <a name="l00273"></a>00273 <span class="comment"> /** Lightweight 3D point (float version).</span> <a name="l00274"></a>00274 <span class="comment"> * \sa mrpt::poses::CPoint3D, mrpt::math::TPoint3D</span> <a name="l00275"></a>00275 <span class="comment"> */</span> <a name="l00276"></a>00276 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPoint3Df <a name="l00277"></a>00277 { <a name="l00278"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a5b003a46a7b3850ffee039f36ec3e3f5">00278</a> <span class="keywordtype">float</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a5b003a46a7b3850ffee039f36ec3e3f5">x</a>; <a name="l00279"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#acdb4c17e9fbbe13cdf0fc4870eb47040">00279</a> <span class="keywordtype">float</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#acdb4c17e9fbbe13cdf0fc4870eb47040">y</a>; <a name="l00280"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a2a3ffdb8ec68e7c3d8917486aef828ed">00280</a> <span class="keywordtype">float</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a2a3ffdb8ec68e7c3d8917486aef828ed">z</a>; <a name="l00281"></a>00281 <a name="l00282"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a1b64c31d018c58bbb5755f88ac0094b9">00282</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a1b64c31d018c58bbb5755f88ac0094b9">TPoint3Df</a>() { } <a name="l00283"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#af055d856fdfc152894c5847b3feb5254">00283</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#af055d856fdfc152894c5847b3feb5254">TPoint3Df</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> xx,<span class="keyword">const</span> <span class="keywordtype">float</span> yy,<span class="keyword">const</span> <span class="keywordtype">float</span> zz) : x(xx), <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(yy),z(zz) { } <a name="l00284"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a2819c0364b0b8cbada7e8f6c98670e26">00284</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">TPoint3Df</a> & <a class="code" href="group__container__ops__grp.html#ga28127b8dfe78fea7644c4f2a3517cdef" title="a+=b (element-wise sum)">operator +=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">TPoint3Df</a> &p) { x+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a5b003a46a7b3850ffee039f36ec3e3f5">x</a>; <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#acdb4c17e9fbbe13cdf0fc4870eb47040">y</a>; z+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a2a3ffdb8ec68e7c3d8917486aef828ed">z</a>; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00285"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html#a47d1b35df18dee0fc35adceefbe5cbf5">00285</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">TPoint3Df</a> <a class="code" href="group__container__ops__grp.html#ga6f2d8625a637a5a65585065331b5b0c5" title="a*b (element-wise multiplication)">operator *</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> s) { <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">TPoint3Df</a>(x*s,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>*s,z*s); } <a name="l00286"></a>00286 }; <a name="l00287"></a>00287 <span class="comment"></span> <a name="l00288"></a>00288 <span class="comment"> /**</span> <a name="l00289"></a>00289 <span class="comment"> * Lightweight 3D point. Allows coordinate access using [] operator.</span> <a name="l00290"></a>00290 <span class="comment"> * \sa mrpt::poses::CPoint3D, mrpt::math::TPoint3Df</span> <a name="l00291"></a>00291 <span class="comment"> */</span> <a name="l00292"></a>00292 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPoint3D { <a name="l00293"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2">00293</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>; <span class="comment">//!< X coordinate</span> <a name="l00294"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37">00294</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>; <span class="comment">//!< Y coordinate</span> <a name="l00295"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307">00295</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>; <span class="comment">//!< Z coordinate</span> <a name="l00296"></a>00296 <span class="comment"></span><span class="comment"></span> <a name="l00297"></a>00297 <span class="comment"> /** Constructor from coordinates. */</span> <a name="l00298"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a49f346076ee40140bd8842ead7213f4d">00298</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a49f346076ee40140bd8842ead7213f4d" title="Constructor from coordinates.">TPoint3D</a>(<span class="keywordtype">double</span> xx,<span class="keywordtype">double</span> yy,<span class="keywordtype">double</span> zz):x(xx),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(yy),z(zz) {}<span class="comment"></span> <a name="l00299"></a>00299 <span class="comment"> /** Default fast constructor. Initializes to garbage. */</span> <a name="l00300"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ac88ae56dff4e7bb251a8dae1a1ba9fce">00300</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ac88ae56dff4e7bb251a8dae1a1ba9fce" title="Default fast constructor.">TPoint3D</a>() {}<span class="comment"></span> <a name="l00301"></a>00301 <span class="comment"> /** Explicit constructor from coordinates. */</span> <a name="l00302"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a95a4f8460eff1819df6aecc37ecae880">00302</a> <span class="keyword">explicit</span> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a95a4f8460eff1819df6aecc37ecae880" title="Explicit constructor from coordinates.">TPoint3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_df.html" title="Lightweight 3D point (float version).">TPoint3Df</a> &p):x(p.x),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(p.<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>),z(p.z) {} <a name="l00303"></a>00303 <span class="comment"></span> <a name="l00304"></a>00304 <span class="comment"> /** Implicit constructor from TPoint2D. Zeroes the z.</span> <a name="l00305"></a>00305 <span class="comment"> * \sa TPoint2D</span> <a name="l00306"></a>00306 <span class="comment"> */</span> <a name="l00307"></a>00307 <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p);<span class="comment"></span> <a name="l00308"></a>00308 <span class="comment"> /**</span> <a name="l00309"></a>00309 <span class="comment"> * Constructor from TPose2D, losing information. Zeroes the z.</span> <a name="l00310"></a>00310 <span class="comment"> * \sa TPose2D</span> <a name="l00311"></a>00311 <span class="comment"> */</span> <a name="l00312"></a>00312 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p);<span class="comment"></span> <a name="l00313"></a>00313 <span class="comment"> /**</span> <a name="l00314"></a>00314 <span class="comment"> * Constructor from TPose3D, losing information.</span> <a name="l00315"></a>00315 <span class="comment"> * \sa TPose3D</span> <a name="l00316"></a>00316 <span class="comment"> */</span> <a name="l00317"></a>00317 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p);<span class="comment"></span> <a name="l00318"></a>00318 <span class="comment"> /**</span> <a name="l00319"></a>00319 <span class="comment"> * Implicit constructor from heavyweight type.</span> <a name="l00320"></a>00320 <span class="comment"> * \sa mrpt::poses::CPoint3D</span> <a name="l00321"></a>00321 <span class="comment"> */</span> <a name="l00322"></a>00322 <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_point3_d.html" title="A class used to store a 3D point.">mrpt::poses::CPoint3D</a> &p);<span class="comment"></span> <a name="l00323"></a>00323 <span class="comment"> /**</span> <a name="l00324"></a>00324 <span class="comment"> * Constructor from heavyweight 3D pose.</span> <a name="l00325"></a>00325 <span class="comment"> * \sa mrpt::poses::CPose3D.</span> <a name="l00326"></a>00326 <span class="comment"> */</span> <a name="l00327"></a>00327 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</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> &p);<span class="comment"></span> <a name="l00328"></a>00328 <span class="comment"> /**</span> <a name="l00329"></a>00329 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00330"></a>00330 <span class="comment"> */</span> <a name="l00331"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#adc2a882dc1bece4135cb55c69bb8c4a0">00331</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#adc2a882dc1bece4135cb55c69bb8c4a0" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00332"></a>00332 <span class="keywordflow">return</span> (&x)[i]; <a name="l00333"></a>00333 }<span class="comment"></span> <a name="l00334"></a>00334 <span class="comment"> /**</span> <a name="l00335"></a>00335 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00336"></a>00336 <span class="comment"> */</span> <a name="l00337"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ad4dc6b3874d856728602c54e3c2bb17f">00337</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ad4dc6b3874d856728602c54e3c2bb17f" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00338"></a>00338 <span class="keywordflow">return</span> (&x)[i]; <a name="l00339"></a>00339 }<span class="comment"></span> <a name="l00340"></a>00340 <span class="comment"> /**</span> <a name="l00341"></a>00341 <span class="comment"> * Point-to-point distance.</span> <a name="l00342"></a>00342 <span class="comment"> */</span> <a name="l00343"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a190bb0eed286244f77639954da86fb90">00343</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a190bb0eed286244f77639954da86fb90" title="Point-to-point distance.">distanceTo</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l00344"></a>00344 <span class="keywordflow">return</span> sqrt(<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>-x)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>-<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>-z)); <a name="l00345"></a>00345 }<span class="comment"></span> <a name="l00346"></a>00346 <span class="comment"> /**</span> <a name="l00347"></a>00347 <span class="comment"> * Point-to-point distance, squared.</span> <a name="l00348"></a>00348 <span class="comment"> */</span> <a name="l00349"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aa01685183f34ad309ec5b0dd20d0561e">00349</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aa01685183f34ad309ec5b0dd20d0561e" title="Point-to-point distance, squared.">sqrDistanceTo</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l00350"></a>00350 <span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>-x)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>-<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>-z); <a name="l00351"></a>00351 }<span class="comment"></span> <a name="l00352"></a>00352 <span class="comment"> /**</span> <a name="l00353"></a>00353 <span class="comment"> * Point norm.</span> <a name="l00354"></a>00354 <span class="comment"> */</span> <a name="l00355"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#af609309059a47f54efe839fd69fdeb8d">00355</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#af609309059a47f54efe839fd69fdeb8d" title="Point norm.">norm</a>()<span class="keyword"> const </span>{ <a name="l00356"></a>00356 <span class="keywordflow">return</span> sqrt(<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(x)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(z)); <a name="l00357"></a>00357 }<span class="comment"></span> <a name="l00358"></a>00358 <span class="comment"> /**</span> <a name="l00359"></a>00359 <span class="comment"> * Point scale.</span> <a name="l00360"></a>00360 <span class="comment"> */</span> <a name="l00361"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ab4f3044fcde6d95ce8a9bf2edae1b126">00361</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ab4f3044fcde6d95ce8a9bf2edae1b126" title="Point scale.">operator*=</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> f) { <a name="l00362"></a>00362 x*=f;<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>*=f;z*=f; <a name="l00363"></a>00363 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00364"></a>00364 }<span class="comment"></span> <a name="l00365"></a>00365 <span class="comment"> /**</span> <a name="l00366"></a>00366 <span class="comment"> * Transformation into vector.</span> <a name="l00367"></a>00367 <span class="comment"> */</span> <a name="l00368"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ae609020cf0a96351dba78d9537b22d67">00368</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ae609020cf0a96351dba78d9537b22d67" title="Transformation into vector.">getAsVector</a>(<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_double</a> &v)<span class="keyword"> const </span>{ <a name="l00369"></a>00369 v.<a class="code" href="structmrpt_1_1dynamicsize__vector.html#a8fd6a8b950613c9abbf6366bcc9d4e4c" title="Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...">resize</a>(3); <a name="l00370"></a>00370 v[0]=x; v[1]=<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>; v[2]=z; <a name="l00371"></a>00371 }<span class="comment"></span> <a name="l00372"></a>00372 <span class="comment"> /**</span> <a name="l00373"></a>00373 <span class="comment"> * Translation.</span> <a name="l00374"></a>00374 <span class="comment"> */</span> <a name="l00375"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ab359e6fd41cfe74c5308bdab364d06b6">00375</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ab359e6fd41cfe74c5308bdab364d06b6" title="Translation.">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p) { <a name="l00376"></a>00376 x+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>; <a name="l00377"></a>00377 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>; <a name="l00378"></a>00378 z+=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>; <a name="l00379"></a>00379 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00380"></a>00380 }<span class="comment"></span> <a name="l00381"></a>00381 <span class="comment"> /**</span> <a name="l00382"></a>00382 <span class="comment"> * Difference between points.</span> <a name="l00383"></a>00383 <span class="comment"> */</span> <a name="l00384"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a25bde1b45542148d92dc0fd8e9f0c525">00384</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a25bde1b45542148d92dc0fd8e9f0c525" title="Difference between points.">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p) { <a name="l00385"></a>00385 x-=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>; <a name="l00386"></a>00386 <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>-=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>; <a name="l00387"></a>00387 z-=p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>; <a name="l00388"></a>00388 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00389"></a>00389 }<span class="comment"></span> <a name="l00390"></a>00390 <span class="comment"> /**</span> <a name="l00391"></a>00391 <span class="comment"> * Points addition.</span> <a name="l00392"></a>00392 <span class="comment"> */</span> <a name="l00393"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a36eb183e50c562cf90b54c14b6609106">00393</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a36eb183e50c562cf90b54c14b6609106" title="Points addition.">operator+</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l00394"></a>00394 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(x+p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>+p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>,z+p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00395"></a>00395 }<span class="comment"></span> <a name="l00396"></a>00396 <span class="comment"> /**</span> <a name="l00397"></a>00397 <span class="comment"> * Points substraction.</span> <a name="l00398"></a>00398 <span class="comment"> */</span> <a name="l00399"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a847c43192b5946e0d3504ac44f7369f2">00399</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a847c43192b5946e0d3504ac44f7369f2" title="Points substraction.">operator-</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l00400"></a>00400 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(x-p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>-p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>,z-p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00401"></a>00401 } <a name="l00402"></a>00402 <a name="l00403"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ae346129ed0109c91767803ada3f0ceeb">00403</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ae346129ed0109c91767803ada3f0ceeb">operator*</a>(<span class="keywordtype">double</span> d)<span class="keyword"> const </span>{ <a name="l00404"></a>00404 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(x*d,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>*d,z*d); <a name="l00405"></a>00405 } <a name="l00406"></a>00406 <a name="l00407"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ad83bbfd0cd8f616674f75eee8728cf17">00407</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ad83bbfd0cd8f616674f75eee8728cf17">operator/</a>(<span class="keywordtype">double</span> d)<span class="keyword"> const </span>{ <a name="l00408"></a>00408 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(x/d,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>/d,z/d); <a name="l00409"></a>00409 } <a name="l00410"></a>00410 <a name="l00411"></a>00411 <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a8ad7d758a7e626faf788eeef3ff417cd">operator<</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p) <span class="keyword">const</span>; <a name="l00412"></a>00412 <span class="comment"></span> <a name="l00413"></a>00413 <span class="comment"> /** Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0.8]" )</span> <a name="l00414"></a>00414 <span class="comment"> * \sa fromString</span> <a name="l00415"></a>00415 <span class="comment"> */</span> <a name="l00416"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ac08cd13736aa5945e136822a18162b45">00416</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#ac08cd13736aa5945e136822a18162b45" title="Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0.8]" )">asString</a>(<a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s)<span class="keyword"> const </span>{ s = <a class="code" href="namespacemrpt.html#a3a27af794b658df5491e2b7678f8ccb8" title="A std::string version of C sprintf.">mrpt::format</a>(<span class="stringliteral">"[%f %f %f]"</span>,x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,z); } <a name="l00417"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aac1429885835a581c5c47168ae9517e8">00417</a> <span class="keyword">inline</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aac1429885835a581c5c47168ae9517e8">asString</a>()<span class="keyword"> const </span>{ std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> s; <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aac1429885835a581c5c47168ae9517e8">asString</a>(s); <span class="keywordflow">return</span> s; } <a name="l00418"></a>00418 <span class="comment"></span> <a name="l00419"></a>00419 <span class="comment"> /** Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0.8]" )</span> <a name="l00420"></a>00420 <span class="comment"> * \sa asString</span> <a name="l00421"></a>00421 <span class="comment"> * \exception std::exception On invalid format</span> <a name="l00422"></a>00422 <span class="comment"> */</span> <a name="l00423"></a>00423 <span class="keywordtype">void</span> fromString(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s); <a name="l00424"></a><a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a9a015aa0e0eaded1ef2ee0ff1fade996">00424</a> <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a9a015aa0e0eaded1ef2ee0ff1fade996">size</a>() { <span class="keywordflow">return</span> 3; } <a name="l00425"></a>00425 }; <a name="l00426"></a>00426 <span class="comment"></span> <a name="l00427"></a>00427 <span class="comment"> /**</span> <a name="l00428"></a>00428 <span class="comment"> * Lightweight 3D pose (three spatial coordinates, plus three angular coordinates). Allows coordinate access using [] operator.</span> <a name="l00429"></a>00429 <span class="comment"> * \sa mrpt::poses::CPose3D</span> <a name="l00430"></a>00430 <span class="comment"> */</span> <a name="l00431"></a>00431 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPose3D {<span class="comment"></span> <a name="l00432"></a>00432 <span class="comment"> /**</span> <a name="l00433"></a>00433 <span class="comment"> * X coordinate.</span> <a name="l00434"></a>00434 <span class="comment"> */</span> <a name="l00435"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233">00435</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233" title="X coordinate.">x</a>;<span class="comment"></span> <a name="l00436"></a>00436 <span class="comment"> /**</span> <a name="l00437"></a>00437 <span class="comment"> * Y coordinate.</span> <a name="l00438"></a>00438 <span class="comment"> */</span> <a name="l00439"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a">00439</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a" title="Y coordinate.">y</a>;<span class="comment"></span> <a name="l00440"></a>00440 <span class="comment"> /**</span> <a name="l00441"></a>00441 <span class="comment"> * Z coordinate.</span> <a name="l00442"></a>00442 <span class="comment"> */</span> <a name="l00443"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76">00443</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76" title="Z coordinate.">z</a>;<span class="comment"></span> <a name="l00444"></a>00444 <span class="comment"> /**</span> <a name="l00445"></a>00445 <span class="comment"> * Yaw coordinate (rotation angle over Z axis).</span> <a name="l00446"></a>00446 <span class="comment"> */</span> <a name="l00447"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9">00447</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9" title="Yaw coordinate (rotation angle over Z axis).">yaw</a>;<span class="comment"></span> <a name="l00448"></a>00448 <span class="comment"> /**</span> <a name="l00449"></a>00449 <span class="comment"> * Pitch coordinate (rotation angle over Y axis).</span> <a name="l00450"></a>00450 <span class="comment"> */</span> <a name="l00451"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580">00451</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580" title="Pitch coordinate (rotation angle over Y axis).">pitch</a>;<span class="comment"></span> <a name="l00452"></a>00452 <span class="comment"> /**</span> <a name="l00453"></a>00453 <span class="comment"> * Roll coordinate (rotation angle over X coordinate).</span> <a name="l00454"></a>00454 <span class="comment"> */</span> <a name="l00455"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98">00455</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98" title="Roll coordinate (rotation angle over X coordinate).">roll</a>;<span class="comment"></span> <a name="l00456"></a>00456 <span class="comment"> /**</span> <a name="l00457"></a>00457 <span class="comment"> * Implicit constructor from TPoint2D. Zeroes all the unprovided information.</span> <a name="l00458"></a>00458 <span class="comment"> * \sa TPoint2D</span> <a name="l00459"></a>00459 <span class="comment"> */</span> <a name="l00460"></a>00460 <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p);<span class="comment"></span> <a name="l00461"></a>00461 <span class="comment"> /**</span> <a name="l00462"></a>00462 <span class="comment"> * Implicit constructor from TPose2D. Gets the yaw from the 2D pose's phi, zeroing all the unprovided information.</span> <a name="l00463"></a>00463 <span class="comment"> * \sa TPose2D</span> <a name="l00464"></a>00464 <span class="comment"> */</span> <a name="l00465"></a>00465 <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p);<span class="comment"></span> <a name="l00466"></a>00466 <span class="comment"> /**</span> <a name="l00467"></a>00467 <span class="comment"> * Implicit constructor from TPoint3D. Zeroes angular information.</span> <a name="l00468"></a>00468 <span class="comment"> * \sa TPoint3D</span> <a name="l00469"></a>00469 <span class="comment"> */</span> <a name="l00470"></a>00470 <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p);<span class="comment"></span> <a name="l00471"></a>00471 <span class="comment"> /**</span> <a name="l00472"></a>00472 <span class="comment"> * Implicit constructor from heavyweight type.</span> <a name="l00473"></a>00473 <span class="comment"> * \sa mrpt::poses::CPose3D</span> <a name="l00474"></a>00474 <span class="comment"> */</span> <a name="l00475"></a>00475 <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</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> &p);<span class="comment"></span> <a name="l00476"></a>00476 <span class="comment"> /**</span> <a name="l00477"></a>00477 <span class="comment"> * Constructor from coordinates.</span> <a name="l00478"></a>00478 <span class="comment"> */</span> <a name="l00479"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a55d71b8d84eb0d3ce3129d740e02c342">00479</a> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a55d71b8d84eb0d3ce3129d740e02c342" title="Constructor from coordinates.">TPose3D</a>(<span class="keywordtype">double</span> _x,<span class="keywordtype">double</span> _y,<span class="keywordtype">double</span> _z,<span class="keywordtype">double</span> _yaw,<span class="keywordtype">double</span> _pitch,<span class="keywordtype">double</span> _roll):x(_x),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(_y),z(_z),yaw(_yaw),pitch(_pitch),roll(_roll) {}<span class="comment"></span> <a name="l00480"></a>00480 <span class="comment"> /**</span> <a name="l00481"></a>00481 <span class="comment"> * Default fast constructor. Initializes to garbage.</span> <a name="l00482"></a>00482 <span class="comment"> */</span> <a name="l00483"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac8e5bd4c137df41d6be88a0739b86286">00483</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac8e5bd4c137df41d6be88a0739b86286" title="Default fast constructor.">TPose3D</a>() {}<span class="comment"></span> <a name="l00484"></a>00484 <span class="comment"> /**</span> <a name="l00485"></a>00485 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00486"></a>00486 <span class="comment"> */</span> <a name="l00487"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac64486dfe0fb4a3b74fa83c672b5f4c7">00487</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac64486dfe0fb4a3b74fa83c672b5f4c7" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00488"></a>00488 <span class="keywordflow">return</span> (&x)[i]; <a name="l00489"></a>00489 }<span class="comment"></span> <a name="l00490"></a>00490 <span class="comment"> /**</span> <a name="l00491"></a>00491 <span class="comment"> * Unsafe coordinate access using operator[]. Intended for loops.</span> <a name="l00492"></a>00492 <span class="comment"> */</span> <a name="l00493"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a4e19a08aa9676d60b9e8dd8a31371c13">00493</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a4e19a08aa9676d60b9e8dd8a31371c13" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00494"></a>00494 <span class="keywordflow">return</span> (&x)[i]; <a name="l00495"></a>00495 }<span class="comment"></span> <a name="l00496"></a>00496 <span class="comment"> /**</span> <a name="l00497"></a>00497 <span class="comment"> * Pose's spatial coordinates norm.</span> <a name="l00498"></a>00498 <span class="comment"> */</span> <a name="l00499"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#abdc2d1bc7428882773b957d4c2ce52ae">00499</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#abdc2d1bc7428882773b957d4c2ce52ae" title="Pose's spatial coordinates norm.">norm</a>()<span class="keyword"> const </span>{ <a name="l00500"></a>00500 <span class="keywordflow">return</span> sqrt(<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(x)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(z)); <a name="l00501"></a>00501 }<span class="comment"></span> <a name="l00502"></a>00502 <span class="comment"> /**</span> <a name="l00503"></a>00503 <span class="comment"> * Gets the pose as a vector of doubles.</span> <a name="l00504"></a>00504 <span class="comment"> */</span> <a name="l00505"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ace014988b5d89b8400fdc58d994e2c35">00505</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ace014988b5d89b8400fdc58d994e2c35" title="Gets the pose as a vector of doubles.">getAsVector</a>(<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_double</a> &v)<span class="keyword"> const </span>{ <a name="l00506"></a>00506 v.<a class="code" href="structmrpt_1_1dynamicsize__vector.html#a8fd6a8b950613c9abbf6366bcc9d4e4c" title="Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...">resize</a>(6); <a name="l00507"></a>00507 v[0]=x; v[1]=<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>; v[2]=z; v[3]=yaw; v[4]=pitch; v[5]=roll; <a name="l00508"></a>00508 }<span class="comment"></span> <a name="l00509"></a>00509 <span class="comment"> /** Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]", angles in degrees.)</span> <a name="l00510"></a>00510 <span class="comment"> * \sa fromString</span> <a name="l00511"></a>00511 <span class="comment"> */</span> <a name="l00512"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a4439957e9d8d6811ec2f854a82976ae7">00512</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a4439957e9d8d6811ec2f854a82976ae7" title="Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]"...">asString</a>(<a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s)<span class="keyword"> const </span>{ s = <a class="code" href="namespacemrpt.html#a3a27af794b658df5491e2b7678f8ccb8" title="A std::string version of C sprintf.">mrpt::format</a>(<span class="stringliteral">"[%f %f %f %f %f %f]"</span>,x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,z,<a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">RAD2DEG</a>(yaw),<a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">RAD2DEG</a>(pitch),<a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">RAD2DEG</a>(roll)); } <a name="l00513"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac6703e1c2059c201e5f65345ec47478a">00513</a> <span class="keyword">inline</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac6703e1c2059c201e5f65345ec47478a">asString</a>()<span class="keyword"> const </span>{ std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> s; <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#ac6703e1c2059c201e5f65345ec47478a">asString</a>(s); <span class="keywordflow">return</span> s; } <a name="l00514"></a>00514 <span class="comment"></span> <a name="l00515"></a>00515 <span class="comment"> /** Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0.8]" )</span> <a name="l00516"></a>00516 <span class="comment"> * \sa asString</span> <a name="l00517"></a>00517 <span class="comment"> * \exception std::exception On invalid format</span> <a name="l00518"></a>00518 <span class="comment"> */</span> <a name="l00519"></a>00519 <span class="keywordtype">void</span> fromString(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s); <a name="l00520"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a47889c4995254b4457d9a41a501508fc">00520</a> <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a47889c4995254b4457d9a41a501508fc">size</a>() { <span class="keywordflow">return</span> 6; } <a name="l00521"></a>00521 }; <a name="l00522"></a>00522 <span class="comment"></span> <a name="l00523"></a>00523 <span class="comment"> /** Lightweight 3D pose (three spatial coordinates, plus a quaternion ). Allows coordinate access using [] operator.</span> <a name="l00524"></a>00524 <span class="comment"> * \sa mrpt::poses::CPose3DQuat</span> <a name="l00525"></a>00525 <span class="comment"> */</span> <a name="l00526"></a>00526 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPose3DQuat { <a name="l00527"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a4d5a55048bb3b66ee87cbe7c6328d49b">00527</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a4d5a55048bb3b66ee87cbe7c6328d49b" title="Translation in x.">x</a>; <span class="comment">//!< Translation in x</span> <a name="l00528"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a62fd68871a749de38ebbe29287997681">00528</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a62fd68871a749de38ebbe29287997681" title="Translation in y.">y</a>; <span class="comment">//!< Translation in y</span> <a name="l00529"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a0bbd0b4bedd6f143a44a0fde5c8c2d8d">00529</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a0bbd0b4bedd6f143a44a0fde5c8c2d8d" title="Translation in z.">z</a>; <span class="comment">//!< Translation in z</span> <a name="l00530"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#ae2896f9022a56dd7c152ddfd809f3045">00530</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#ae2896f9022a56dd7c152ddfd809f3045" title="Quaternion part, r.">qr</a>; <span class="comment">//!< Quaternion part, r</span> <a name="l00531"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a1c01f4eb8f3728caec6753ed192c7dd1">00531</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a1c01f4eb8f3728caec6753ed192c7dd1" title="Quaternion part, x.">qx</a>; <span class="comment">//!< Quaternion part, x</span> <a name="l00532"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a32fb79e398c5f663381dccc24f797ca7">00532</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a32fb79e398c5f663381dccc24f797ca7" title="Quaternion part, y.">qy</a>; <span class="comment">//!< Quaternion part, y</span> <a name="l00533"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a27a79c5282701f4ff99d96dbbb19de01">00533</a> <span class="comment"></span> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a27a79c5282701f4ff99d96dbbb19de01" title="Quaternion part, z.">qz</a>; <span class="comment">//!< Quaternion part, z</span> <a name="l00534"></a>00534 <span class="comment"></span><span class="comment"></span> <a name="l00535"></a>00535 <span class="comment"> /** Constructor from coordinates. */</span> <a name="l00536"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a4f714e3ed54dfc40593cb1e0db94314e">00536</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a4f714e3ed54dfc40593cb1e0db94314e" title="Constructor from coordinates.">TPose3DQuat</a>(<span class="keywordtype">double</span> _x,<span class="keywordtype">double</span> _y,<span class="keywordtype">double</span> _z,<span class="keywordtype">double</span> _qr,<span class="keywordtype">double</span> _qx, <span class="keywordtype">double</span> _qy, <span class="keywordtype">double</span> _qz):x(_x),<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>(_y),z(_z),qr(_qr),qx(_qx),qy(_qy),qz(_qz) { }<span class="comment"></span> <a name="l00537"></a>00537 <span class="comment"> /** Default fast constructor. Initializes to garbage. */</span> <a name="l00538"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#af5120dbe7526dde16ec24f8138c8f021">00538</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#af5120dbe7526dde16ec24f8138c8f021" title="Default fast constructor.">TPose3DQuat</a>() {}<span class="comment"></span> <a name="l00539"></a>00539 <span class="comment"> /** Constructor from a CPose3DQuat */</span> <a name="l00540"></a>00540 <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html" title="Lightweight 3D pose (three spatial coordinates, plus a quaternion ).">TPose3DQuat</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d_quat.html" title="A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).">mrpt::poses::CPose3DQuat</a> &p); <a name="l00541"></a>00541 <span class="comment"></span> <a name="l00542"></a>00542 <span class="comment"> /** Unsafe coordinate access using operator[]. Intended for loops. */</span> <a name="l00543"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a53c8b9d2d56bf77f1ec5a9a175e13f02">00543</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a53c8b9d2d56bf77f1ec5a9a175e13f02" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00544"></a>00544 <span class="keywordflow">return</span> (&x)[i]; <a name="l00545"></a>00545 }<span class="comment"></span> <a name="l00546"></a>00546 <span class="comment"> /** Unsafe coordinate access using operator[]. Intended for loops. */</span> <a name="l00547"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a3796a37f121ed959ed86bef112588863">00547</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">double</span> &<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a3796a37f121ed959ed86bef112588863" title="Unsafe coordinate access using operator[].">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00548"></a>00548 <span class="keywordflow">return</span> (&x)[i]; <a name="l00549"></a>00549 }<span class="comment"></span> <a name="l00550"></a>00550 <span class="comment"> /** Pose's spatial coordinates norm. */</span> <a name="l00551"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a6604758e2ba46d2452b8689c10f48cd4">00551</a> <span class="keywordtype">double</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a6604758e2ba46d2452b8689c10f48cd4" title="Pose's spatial coordinates norm.">norm</a>()<span class="keyword"> const </span>{ <a name="l00552"></a>00552 <span class="keywordflow">return</span> sqrt(<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(x)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(z)); <a name="l00553"></a>00553 }<span class="comment"></span> <a name="l00554"></a>00554 <span class="comment"> /** Gets the pose as a vector of doubles. */</span> <a name="l00555"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a2a1dac159d31019fbc71f9779a1afc1f">00555</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a2a1dac159d31019fbc71f9779a1afc1f" title="Gets the pose as a vector of doubles.">getAsVector</a>(<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_double</a> &v)<span class="keyword"> const </span>{ <a name="l00556"></a>00556 v.<a class="code" href="structmrpt_1_1dynamicsize__vector.html#a8fd6a8b950613c9abbf6366bcc9d4e4c" title="Overloaded resize method that mimics std::vector::resize(SIZE,DEFAULT_VALUE) instead of resize(nrows...">resize</a>(7); <a name="l00557"></a>00557 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<7;i++) v[i]=(*<span class="keyword">this</span>)[i]; <a name="l00558"></a>00558 }<span class="comment"></span> <a name="l00559"></a>00559 <span class="comment"> /** Returns a human-readable textual representation of the object as "[x y z qr qx qy qz]"</span> <a name="l00560"></a>00560 <span class="comment"> * \sa fromString</span> <a name="l00561"></a>00561 <span class="comment"> */</span> <a name="l00562"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#aad5b6428bf78856042b8b67e76dfbf86">00562</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#aad5b6428bf78856042b8b67e76dfbf86" title="Returns a human-readable textual representation of the object as "[x y z qr qx qy qz]"...">asString</a>(<a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s)<span class="keyword"> const </span>{ s = <a class="code" href="namespacemrpt.html#a3a27af794b658df5491e2b7678f8ccb8" title="A std::string version of C sprintf.">mrpt::format</a>(<span class="stringliteral">"[%f %f %f %f %f %f %f]"</span>,x,<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,z,qr,qx,qy,qz); } <a name="l00563"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a7a191735aaf9707f516ad2b7d0d1d316">00563</a> <span class="keyword">inline</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a7a191735aaf9707f516ad2b7d0d1d316">asString</a>()<span class="keyword"> const </span>{ std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> s; <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a7a191735aaf9707f516ad2b7d0d1d316">asString</a>(s); <span class="keywordflow">return</span> s; } <a name="l00564"></a>00564 <span class="comment"></span> <a name="l00565"></a>00565 <span class="comment"> /** Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0.8 1.0 0.0 0.0 0.0]" )</span> <a name="l00566"></a>00566 <span class="comment"> * \sa asString</span> <a name="l00567"></a>00567 <span class="comment"> * \exception std::exception On invalid format</span> <a name="l00568"></a>00568 <span class="comment"> */</span> <a name="l00569"></a>00569 <span class="keywordtype">void</span> fromString(<span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &s); <a name="l00570"></a><a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a51bfcb06034c33335a6887ffae9be098">00570</a> <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d_quat.html#a51bfcb06034c33335a6887ffae9be098">size</a>() { <span class="keywordflow">return</span> 7; } <a name="l00571"></a>00571 }; <a name="l00572"></a>00572 <span class="preprocessor">#pragma pack(pop)</span> <a name="l00573"></a>00573 <span class="preprocessor"></span> <a name="l00574"></a>00574 <span class="comment">// Text streaming functions:</span> <a name="l00575"></a>00575 std::ostream <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> & <a class="code" href="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">operator << </a>(<a class="code" href="classstd_1_1ostream.html" title="STL class.">std::ostream</a>& o, <span class="keyword">const</span> TPoint2D & p); <a name="l00576"></a>00576 std::ostream <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> & <a class="code" href="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">operator << </a>(<a class="code" href="classstd_1_1ostream.html" title="STL class.">std::ostream</a>& o, <span class="keyword">const</span> TPoint3D & p); <a name="l00577"></a>00577 std::ostream <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> & <a class="code" href="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">operator << </a>(<a class="code" href="classstd_1_1ostream.html" title="STL class.">std::ostream</a>& o, <span class="keyword">const</span> TPose2D & p); <a name="l00578"></a>00578 std::ostream <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> & <a class="code" href="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">operator << </a>(<a class="code" href="classstd_1_1ostream.html" title="STL class.">std::ostream</a>& o, <span class="keyword">const</span> TPose3D & p); <a name="l00579"></a>00579 std::ostream <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> & <a class="code" href="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">operator << </a>(<a class="code" href="classstd_1_1ostream.html" title="STL class.">std::ostream</a>& o, <span class="keyword">const</span> TPose3DQuat & p); <a name="l00580"></a>00580 <a name="l00581"></a>00581 <span class="comment"></span> <a name="l00582"></a>00582 <span class="comment"> /**</span> <a name="l00583"></a>00583 <span class="comment"> * Unary minus operator for 3D points.</span> <a name="l00584"></a>00584 <span class="comment"> */</span> <a name="l00585"></a><a class="code" href="group__geometry__grp.html#ga41dd79738f6a27f4b63ee22080eec843">00585</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="group__geometry__grp.html#ga41dd79738f6a27f4b63ee22080eec843" title="Unary minus operator for 3D points.">operator-</a>(<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) { <a name="l00586"></a>00586 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>(-p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>,-p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>,-p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00587"></a>00587 }<span class="comment"></span> <a name="l00588"></a>00588 <span class="comment"> /**</span> <a name="l00589"></a>00589 <span class="comment"> * Exact comparison between 2D points.</span> <a name="l00590"></a>00590 <span class="comment"> */</span> <a name="l00591"></a><a class="code" href="group__geometry__grp.html#gaef7a1b4acfd8df1780f54ccf2725bec6">00591</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p2) { <a name="l00592"></a>00592 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>); <a name="l00593"></a>00593 }<span class="comment"></span> <a name="l00594"></a>00594 <span class="comment"> /**</span> <a name="l00595"></a>00595 <span class="comment"> * Exact comparison between 2D points.</span> <a name="l00596"></a>00596 <span class="comment"> */</span> <a name="l00597"></a><a class="code" href="group__geometry__grp.html#ga30e184e42686c929b057a782c5420381">00597</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p2) { <a name="l00598"></a>00598 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>); <a name="l00599"></a>00599 }<span class="comment"></span> <a name="l00600"></a>00600 <span class="comment"> /**</span> <a name="l00601"></a>00601 <span class="comment"> * Exact comparison between 3D points.</span> <a name="l00602"></a>00602 <span class="comment"> */</span> <a name="l00603"></a><a class="code" href="group__geometry__grp.html#ga3d8fa05b84f5283269f4f4d06f0136bd">00603</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<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) { <a name="l00604"></a>00604 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00605"></a>00605 }<span class="comment"></span> <a name="l00606"></a>00606 <span class="comment"> /**</span> <a name="l00607"></a>00607 <span class="comment"> * Exact comparison between 3D points.</span> <a name="l00608"></a>00608 <span class="comment"> */</span> <a name="l00609"></a><a class="code" href="group__geometry__grp.html#ga0ce1351e12712693cfbe5318fb8acae1">00609</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<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) { <a name="l00610"></a>00610 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00611"></a>00611 }<span class="comment"></span> <a name="l00612"></a>00612 <span class="comment"> /**</span> <a name="l00613"></a>00613 <span class="comment"> * Exact comparison between 2D poses, taking possible cycles into account.</span> <a name="l00614"></a>00614 <span class="comment"> */</span> <a name="l00615"></a><a class="code" href="group__geometry__grp.html#ga3b0d2c0eb8f001423ccd854814a92187">00615</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p2) { <a name="l00616"></a>00616 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264" title="X coordinate.">x</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264" title="X coordinate.">x</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387" title="Y coordinate.">y</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387" title="Y coordinate.">y</a>)&&(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f" title="Phi coordinate.">phi</a>)==<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f" title="Phi coordinate.">phi</a>)); <a name="l00617"></a>00617 }<span class="comment"></span> <a name="l00618"></a>00618 <span class="comment"> /**</span> <a name="l00619"></a>00619 <span class="comment"> * Exact comparison between 2D poses, taking possible cycles into account.</span> <a name="l00620"></a>00620 <span class="comment"> */</span> <a name="l00621"></a><a class="code" href="group__geometry__grp.html#gaf6339aa7f1cdc6c0a7049756f9417d2b">00621</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">TPose2D</a> &p2) { <a name="l00622"></a>00622 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264" title="X coordinate.">x</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a4e0f59996ff467539d21a402d8251264" title="X coordinate.">x</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387" title="Y coordinate.">y</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a47f362c442c15e7dccee6704cef4f387" title="Y coordinate.">y</a>)||(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f" title="Phi coordinate.">phi</a>)!=<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html#a0a82abf23dbae9f3e78be72aed1c9f9f" title="Phi coordinate.">phi</a>)); <a name="l00623"></a>00623 }<span class="comment"></span> <a name="l00624"></a>00624 <span class="comment"> /**</span> <a name="l00625"></a>00625 <span class="comment"> * Exact comparison between 3D poses, taking possible cycles into account.</span> <a name="l00626"></a>00626 <span class="comment"> */</span> <a name="l00627"></a><a class="code" href="group__geometry__grp.html#ga315107e68e10847038343a6bb609e49d">00627</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p2) { <a name="l00628"></a>00628 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233" title="X coordinate.">x</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233" title="X coordinate.">x</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a" title="Y coordinate.">y</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a" title="Y coordinate.">y</a>)&&(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76" title="Z coordinate.">z</a>==p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76" title="Z coordinate.">z</a>)&&(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9" title="Yaw coordinate (rotation angle over Z axis).">yaw</a>)==<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9" title="Yaw coordinate (rotation angle over Z axis).">yaw</a>))&&(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580" title="Pitch coordinate (rotation angle over Y axis).">pitch</a>)==<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580" title="Pitch coordinate (rotation angle over Y axis).">pitch</a>))&&(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98" title="Roll coordinate (rotation angle over X coordinate).">roll</a>)==<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98" title="Roll coordinate (rotation angle over X coordinate).">roll</a>)); <a name="l00629"></a>00629 }<span class="comment"></span> <a name="l00630"></a>00630 <span class="comment"> /**</span> <a name="l00631"></a>00631 <span class="comment"> * Exact comparison between 3D poses, taking possible cycles into account.</span> <a name="l00632"></a>00632 <span class="comment"> */</span> <a name="l00633"></a><a class="code" href="group__geometry__grp.html#ga2696598ea83b926010a0457c53bfe285">00633</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">TPose3D</a> &p2) { <a name="l00634"></a>00634 <span class="keywordflow">return</span> (p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233" title="X coordinate.">x</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a58c4aff2e15ffe59fcd033a1b8a9a233" title="X coordinate.">x</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a" title="Y coordinate.">y</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a0fc71229e42e72ead9652312ae69259a" title="Y coordinate.">y</a>)||(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76" title="Z coordinate.">z</a>!=p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a62c86a3ad1d59501afca2b30cd4f9d76" title="Z coordinate.">z</a>)||(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9" title="Yaw coordinate (rotation angle over Z axis).">yaw</a>)!=<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#af57c4381902066aac35d93746ed9dff9" title="Yaw coordinate (rotation angle over Z axis).">yaw</a>))||(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580" title="Pitch coordinate (rotation angle over Y axis).">pitch</a>)!=<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#acab2927c55a45e830e741220339bc580" title="Pitch coordinate (rotation angle over Y axis).">pitch</a>))||(<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p1.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98" title="Roll coordinate (rotation angle over X coordinate).">roll</a>)!=<a class="code" href="group__container__ops__grp.html#ga81ffbc190c3274c294a71aad568e98e3" title="Modifies the given angle to translate it into the [0,2pi[ range.">mrpt::math::wrapTo2Pi</a>(p2.<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html#a6ca364705b1001f112cf423ad68b5a98" title="Roll coordinate (rotation angle over X coordinate).">roll</a>)); <a name="l00635"></a>00635 } <a name="l00636"></a>00636 <span class="comment">//Forward declarations</span> <a name="l00637"></a><a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">00637</a> <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a>; <a name="l00638"></a><a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">00638</a> <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a>; <a name="l00639"></a><a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">00639</a> <span class="keyword">class </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a>; <a name="l00640"></a><a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">00640</a> <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">TObject3D</a>; <a name="l00641"></a>00641 <a name="l00642"></a>00642 <span class="comment">//Pragma defined to ensure no structure packing</span> <a name="l00643"></a>00643 <span class="preprocessor">#pragma pack(push,1)</span> <a name="l00644"></a>00644 <span class="preprocessor"></span><span class="comment"> /**</span> <a name="l00645"></a>00645 <span class="comment"> * 2D segment, consisting of two points.</span> <a name="l00646"></a>00646 <span class="comment"> * \sa TSegment3D,TLine2D,TPolygon2D,TPoint2D</span> <a name="l00647"></a>00647 <span class="comment"> */</span> <a name="l00648"></a>00648 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> { <a name="l00649"></a>00649 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00650"></a>00650 <span class="comment"> /**</span> <a name="l00651"></a>00651 <span class="comment"> * Origin point.</span> <a name="l00652"></a>00652 <span class="comment"> */</span> <a name="l00653"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b">00653</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>;<span class="comment"></span> <a name="l00654"></a>00654 <span class="comment"> /**</span> <a name="l00655"></a>00655 <span class="comment"> * Destiny point.</span> <a name="l00656"></a>00656 <span class="comment"> */</span> <a name="l00657"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91">00657</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>;<span class="comment"></span> <a name="l00658"></a>00658 <span class="comment"> /**</span> <a name="l00659"></a>00659 <span class="comment"> * Segment length.</span> <a name="l00660"></a>00660 <span class="comment"> */</span> <a name="l00661"></a>00661 <span class="keywordtype">double</span> length() <span class="keyword">const</span>;<span class="comment"></span> <a name="l00662"></a>00662 <span class="comment"> /**</span> <a name="l00663"></a>00663 <span class="comment"> * Distance to point.</span> <a name="l00664"></a>00664 <span class="comment"> */</span> <a name="l00665"></a>00665 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00666"></a>00666 <span class="comment"> /**</span> <a name="l00667"></a>00667 <span class="comment"> * Distance with sign to point (sign indicates which side the point is).</span> <a name="l00668"></a>00668 <span class="comment"> */</span> <a name="l00669"></a>00669 <span class="keywordtype">double</span> signedDistance(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00670"></a>00670 <span class="comment"> /**</span> <a name="l00671"></a>00671 <span class="comment"> * Check whether a point is inside a segment.</span> <a name="l00672"></a>00672 <span class="comment"> */</span> <a name="l00673"></a>00673 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00674"></a>00674 <span class="comment"> /**</span> <a name="l00675"></a>00675 <span class="comment"> * Unsafe point access using [] operator, intended for loops.</span> <a name="l00676"></a>00676 <span class="comment"> */</span> <a name="l00677"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#aa7fa2ad13be504e4130641ee864cb651">00677</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#aa7fa2ad13be504e4130641ee864cb651" title="Unsafe point access using [] operator, intended for loops.">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00678"></a>00678 <span class="keywordflow">return</span> (&point1)[i]; <a name="l00679"></a>00679 }<span class="comment"></span> <a name="l00680"></a>00680 <span class="comment"> /**</span> <a name="l00681"></a>00681 <span class="comment"> * Unsafe point access using [] operator, intended for loops.</span> <a name="l00682"></a>00682 <span class="comment"> */</span> <a name="l00683"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#aa51a0827ed95fa5e31d7bb9c0b78f320">00683</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#aa51a0827ed95fa5e31d7bb9c0b78f320" title="Unsafe point access using [] operator, intended for loops.">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00684"></a>00684 <span class="keywordflow">return</span> (&point1)[i]; <a name="l00685"></a>00685 }<span class="comment"></span> <a name="l00686"></a>00686 <span class="comment"> /**</span> <a name="l00687"></a>00687 <span class="comment"> * Project into 3D space, setting the z to 0.</span> <a name="l00688"></a>00688 <span class="comment"> */</span> <a name="l00689"></a>00689 <span class="keywordtype">void</span> generate3DObject(<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00690"></a>00690 <span class="comment"> /**</span> <a name="l00691"></a>00691 <span class="comment"> * Segment's central point.</span> <a name="l00692"></a>00692 <span class="comment"> */</span> <a name="l00693"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a1e31240f54664dae46056cbf2b00e7aa">00693</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a1e31240f54664dae46056cbf2b00e7aa" title="Segment's central point.">getCenter</a>(<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p)<span class="keyword"> const </span>{ <a name="l00694"></a>00694 p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a084825c8b4d02df7b89d66f8b08e26f2" title="X coordinate.">x</a>=(point1.x+point2.x)/2; <a name="l00695"></a>00695 p.<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html#a1b6b3c44215ec8285ae97ff1ad1f6fcf" title="Y coordinate.">y</a>=(point1.y+point2.y)/2; <a name="l00696"></a>00696 }<span class="comment"></span> <a name="l00697"></a>00697 <span class="comment"> /**</span> <a name="l00698"></a>00698 <span class="comment"> * Constructor from both points.</span> <a name="l00699"></a>00699 <span class="comment"> */</span> <a name="l00700"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a443db0e4874d44a979bb02b40a702a16">00700</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a443db0e4874d44a979bb02b40a702a16" title="Constructor from both points.">TSegment2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p2):point1(p1),point2(p2) {}<span class="comment"></span> <a name="l00701"></a>00701 <span class="comment"> /**</span> <a name="l00702"></a>00702 <span class="comment"> * Fast default constructor. Initializes to garbage.</span> <a name="l00703"></a>00703 <span class="comment"> */</span> <a name="l00704"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a811f4347a0b517b0083c87845f8a4fc7">00704</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a811f4347a0b517b0083c87845f8a4fc7" title="Fast default constructor.">TSegment2D</a>() {}<span class="comment"></span> <a name="l00705"></a>00705 <span class="comment"> /**</span> <a name="l00706"></a>00706 <span class="comment"> * Explicit constructor from 3D object, discarding the z.</span> <a name="l00707"></a>00707 <span class="comment"> */</span> <a name="l00708"></a>00708 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s); <a name="l00709"></a>00709 <a name="l00710"></a>00710 <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a8ad7d758a7e626faf788eeef3ff417cd">operator<</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s) <span class="keyword">const</span>; <a name="l00711"></a>00711 };<span class="comment"></span> <a name="l00712"></a>00712 <span class="comment"> /**</span> <a name="l00713"></a>00713 <span class="comment"> * 3D segment, consisting of two points.</span> <a name="l00714"></a>00714 <span class="comment"> * \sa TSegment2D,TLine3D,TPlane,TPolygon3D,TPoint3D</span> <a name="l00715"></a>00715 <span class="comment"> */</span> <a name="l00716"></a>00716 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> { <a name="l00717"></a>00717 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00718"></a>00718 <span class="comment"> /**</span> <a name="l00719"></a>00719 <span class="comment"> * Origin point.</span> <a name="l00720"></a>00720 <span class="comment"> */</span> <a name="l00721"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a">00721</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>;<span class="comment"></span> <a name="l00722"></a>00722 <span class="comment"> /**</span> <a name="l00723"></a>00723 <span class="comment"> * Destiny point.</span> <a name="l00724"></a>00724 <span class="comment"> */</span> <a name="l00725"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79">00725</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>;<span class="comment"></span> <a name="l00726"></a>00726 <span class="comment"> /**</span> <a name="l00727"></a>00727 <span class="comment"> * Segment length.</span> <a name="l00728"></a>00728 <span class="comment"> */</span> <a name="l00729"></a>00729 <span class="keywordtype">double</span> length() <span class="keyword">const</span>;<span class="comment"></span> <a name="l00730"></a>00730 <span class="comment"> /**</span> <a name="l00731"></a>00731 <span class="comment"> * Distance to point.</span> <a name="l00732"></a>00732 <span class="comment"> */</span> <a name="l00733"></a>00733 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00734"></a>00734 <span class="comment"> /**</span> <a name="l00735"></a>00735 <span class="comment"> * Check whether a point is inside the segment.</span> <a name="l00736"></a>00736 <span class="comment"> */</span> <a name="l00737"></a>00737 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00738"></a>00738 <span class="comment"> /**</span> <a name="l00739"></a>00739 <span class="comment"> * Unsafe point access using [] operator, intended for loops.</span> <a name="l00740"></a>00740 <span class="comment"> */</span> <a name="l00741"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#abbd139c2854cfdc719b3114c590bda3d">00741</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#abbd139c2854cfdc719b3114c590bda3d" title="Unsafe point access using [] operator, intended for loops.">operator[]</a>(<span class="keywordtype">size_t</span> i) { <a name="l00742"></a>00742 <span class="keywordflow">return</span> (&point1)[i]; <a name="l00743"></a>00743 }<span class="comment"></span> <a name="l00744"></a>00744 <span class="comment"> /**</span> <a name="l00745"></a>00745 <span class="comment"> * Unsafe point access using [] operator, intended for loops.</span> <a name="l00746"></a>00746 <span class="comment"> */</span> <a name="l00747"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a3d0627e3677ed4f76b44645517527b49">00747</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a3d0627e3677ed4f76b44645517527b49" title="Unsafe point access using [] operator, intended for loops.">operator[]</a>(<span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{ <a name="l00748"></a>00748 <span class="keywordflow">return</span> (&point1)[i]; <a name="l00749"></a>00749 }<span class="comment"></span> <a name="l00750"></a>00750 <span class="comment"> /**</span> <a name="l00751"></a>00751 <span class="comment"> * Projection into 2D space, discarding the z.</span> <a name="l00752"></a>00752 <span class="comment"> */</span> <a name="l00753"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a25562fa49bb2b109f1660f8d9fa2608e">00753</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a25562fa49bb2b109f1660f8d9fa2608e" title="Projection into 2D space, discarding the z.">generate2DObject</a>(<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s)<span class="keyword"> const </span>{ <a name="l00754"></a>00754 s=<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(*<span class="keyword">this</span>); <a name="l00755"></a>00755 }<span class="comment"></span> <a name="l00756"></a>00756 <span class="comment"> /**</span> <a name="l00757"></a>00757 <span class="comment"> * Segment's central point.</span> <a name="l00758"></a>00758 <span class="comment"> */</span> <a name="l00759"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a92a8c8ae4dcb5bede8e6e0fd028e4477">00759</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a92a8c8ae4dcb5bede8e6e0fd028e4477" title="Segment's central point.">getCenter</a>(<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l00760"></a>00760 p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>=(point1.x+point2.x)/2; <a name="l00761"></a>00761 p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>=(point1.y+point2.y)/2; <a name="l00762"></a>00762 p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>=(point1.z+point2.z)/2; <a name="l00763"></a>00763 }<span class="comment"></span> <a name="l00764"></a>00764 <span class="comment"> /**</span> <a name="l00765"></a>00765 <span class="comment"> * Constructor from both points.</span> <a name="l00766"></a>00766 <span class="comment"> */</span> <a name="l00767"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#af02d546bacd9d6ec93025e179bdbb40e">00767</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#af02d546bacd9d6ec93025e179bdbb40e" title="Constructor from both points.">TSegment3D</a>(<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):point1(p1),point2(p2) {}<span class="comment"></span> <a name="l00768"></a>00768 <span class="comment"> /**</span> <a name="l00769"></a>00769 <span class="comment"> * Fast default constructor. Initializes to garbage.</span> <a name="l00770"></a>00770 <span class="comment"> */</span> <a name="l00771"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#adbbd39f3e5247feb12dbe4bcfc6e178f">00771</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#adbbd39f3e5247feb12dbe4bcfc6e178f" title="Fast default constructor.">TSegment3D</a>() {}<span class="comment"></span> <a name="l00772"></a>00772 <span class="comment"> /**</span> <a name="l00773"></a>00773 <span class="comment"> * Constructor from 2D object. Sets the z to zero.</span> <a name="l00774"></a>00774 <span class="comment"> */</span> <a name="l00775"></a><a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#af80d7baa2f944bdf4642e579c0774718">00775</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#af80d7baa2f944bdf4642e579c0774718" title="Constructor from 2D object.">TSegment3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s):point1(s.point1),point2(s.point2) {} <a name="l00776"></a>00776 <a name="l00777"></a>00777 <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a8ad7d758a7e626faf788eeef3ff417cd">operator<</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s) <span class="keyword">const</span>; <a name="l00778"></a>00778 }; <a name="l00779"></a>00779 <span class="preprocessor">#pragma pack(pop)</span> <a name="l00780"></a>00780 <span class="preprocessor"></span> <a name="l00781"></a><a class="code" href="group__geometry__grp.html#gaf6b5b50bad9ca722909c044f785589aa">00781</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s2) { <a name="l00782"></a>00782 <span class="keywordflow">return</span> (s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>==s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>)&&(s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>==s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>); <a name="l00783"></a>00783 } <a name="l00784"></a>00784 <a name="l00785"></a><a class="code" href="group__geometry__grp.html#gac847cd29b920a25d160d642afc1ca5f5">00785</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s2) { <a name="l00786"></a>00786 <span class="keywordflow">return</span> (s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>!=s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>)||(s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>!=s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>); <a name="l00787"></a>00787 } <a name="l00788"></a>00788 <a name="l00789"></a><a class="code" href="group__geometry__grp.html#ga0759bd5ff55164037663876bb5c589e5">00789</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#ad4a5f953c6f98c279c7d3ff13bbb223a">operator==</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s2) { <a name="l00790"></a>00790 <span class="keywordflow">return</span> (s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>==s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>)&&(s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>==s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>); <a name="l00791"></a>00791 } <a name="l00792"></a>00792 <a name="l00793"></a><a class="code" href="group__geometry__grp.html#ga3e99b3d8a2aa7739c50ee0c6e33d5556">00793</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacemrpt_1_1math.html#a9530d437eede574017f58f04ad36bcf9">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s2) { <a name="l00794"></a>00794 <span class="keywordflow">return</span> (s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>!=s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>)||(s1.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>!=s2.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>); <a name="l00795"></a>00795 } <a name="l00796"></a>00796 <span class="comment"></span> <a name="l00797"></a>00797 <span class="comment"> /**</span> <a name="l00798"></a>00798 <span class="comment"> * 2D line without bounds, represented by its equation \f$Ax+By+C=0\f$.</span> <a name="l00799"></a>00799 <span class="comment"> * \sa TLine3D,TSegment2D,TPolygon2D,TPoint2D</span> <a name="l00800"></a>00800 <span class="comment"> */</span> <a name="l00801"></a>00801 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TLine2D { <a name="l00802"></a>00802 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00803"></a>00803 <span class="comment"> /**</span> <a name="l00804"></a>00804 <span class="comment"> * Line coefficients, stored as an array: \f$\left[A,B,C\right]\f$.</span> <a name="l00805"></a>00805 <span class="comment"> */</span> <a name="l00806"></a><a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00">00806</a> <span class="keywordtype">double</span> coefs[3];<span class="comment"></span> <a name="l00807"></a>00807 <span class="comment"> /**</span> <a name="l00808"></a>00808 <span class="comment"> * Evaluate point in the line's equation.</span> <a name="l00809"></a>00809 <span class="comment"> */</span> <a name="l00810"></a>00810 <span class="keywordtype">double</span> evaluatePoint(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00811"></a>00811 <span class="comment"> /**</span> <a name="l00812"></a>00812 <span class="comment"> * Check whether a point is inside the line.</span> <a name="l00813"></a>00813 <span class="comment"> */</span> <a name="l00814"></a>00814 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00815"></a>00815 <span class="comment"> /**</span> <a name="l00816"></a>00816 <span class="comment"> * Distance from a given point.</span> <a name="l00817"></a>00817 <span class="comment"> */</span> <a name="l00818"></a>00818 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00819"></a>00819 <span class="comment"> /**</span> <a name="l00820"></a>00820 <span class="comment"> * Distance with sign from a given point (sign indicates side).</span> <a name="l00821"></a>00821 <span class="comment"> */</span> <a name="l00822"></a>00822 <span class="keywordtype">double</span> signedDistance(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00823"></a>00823 <span class="comment"> /**</span> <a name="l00824"></a>00824 <span class="comment"> * Get line's normal vector.</span> <a name="l00825"></a>00825 <span class="comment"> */</span> <a name="l00826"></a>00826 <span class="keywordtype">void</span> getNormalVector(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[2]) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00827"></a>00827 <span class="comment"> /**</span> <a name="l00828"></a>00828 <span class="comment"> * Unitarize line's normal vector.</span> <a name="l00829"></a>00829 <span class="comment"> */</span> <a name="l00830"></a>00830 <span class="keywordtype">void</span> unitarize();<span class="comment"></span> <a name="l00831"></a>00831 <span class="comment"> /**</span> <a name="l00832"></a>00832 <span class="comment"> * Get line's normal vector after unitarizing line.</span> <a name="l00833"></a>00833 <span class="comment"> */</span> <a name="l00834"></a><a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#afd78002b85ca6101060812106b7fa2f3">00834</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#afd78002b85ca6101060812106b7fa2f3" title="Get line's normal vector after unitarizing line.">getUnitaryNormalVector</a>(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[2]) { <a name="l00835"></a>00835 unitarize(); <a name="l00836"></a>00836 getNormalVector(<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>); <a name="l00837"></a>00837 }<span class="comment"></span> <a name="l00838"></a>00838 <span class="comment"> /**</span> <a name="l00839"></a>00839 <span class="comment"> * Get line's director vector.</span> <a name="l00840"></a>00840 <span class="comment"> */</span> <a name="l00841"></a>00841 <span class="keywordtype">void</span> getDirectorVector(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[2]) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00842"></a>00842 <span class="comment"> /**</span> <a name="l00843"></a>00843 <span class="comment"> * Unitarize line and then get director vector.</span> <a name="l00844"></a>00844 <span class="comment"> */</span> <a name="l00845"></a><a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a893248f4287a5b60efbea7504117e95b">00845</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a893248f4287a5b60efbea7504117e95b" title="Unitarize line and then get director vector.">getUnitaryDirectorVector</a>(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[2]) { <a name="l00846"></a>00846 unitarize(); <a name="l00847"></a>00847 getDirectorVector(<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>); <a name="l00848"></a>00848 }<span class="comment"></span> <a name="l00849"></a>00849 <span class="comment"> /**</span> <a name="l00850"></a>00850 <span class="comment"> * Project into 3D space, setting the z to 0.</span> <a name="l00851"></a>00851 <span class="comment"> */</span> <a name="l00852"></a>00852 <span class="keywordtype">void</span> generate3DObject(<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &l) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00853"></a>00853 <span class="comment"> /**</span> <a name="l00854"></a>00854 <span class="comment"> * Get a pose2D whose X axis corresponds to the line.</span> <a name="l00855"></a>00855 <span class="comment"> * \sa mrpt::poses::CPose2D.</span> <a name="l00856"></a>00856 <span class="comment"> */</span> <a name="l00857"></a>00857 <span class="keywordtype">void</span> getAsPose2D(<a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">mrpt::poses::CPose2D</a> &outPose) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00858"></a>00858 <span class="comment"> /**</span> <a name="l00859"></a>00859 <span class="comment"> * Get a pose2D whose X axis corresponds to the line, forcing the base point to one given.</span> <a name="l00860"></a>00860 <span class="comment"> * \throw logic_error if the point is not inside the line.</span> <a name="l00861"></a>00861 <span class="comment"> * \sa mrpt::poses::CPose2D.</span> <a name="l00862"></a>00862 <span class="comment"> */</span> <a name="l00863"></a>00863 <span class="keywordtype">void</span> getAsPose2DForcingOrigin(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &origin,<a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">mrpt::poses::CPose2D</a> &outPose) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00864"></a>00864 <span class="comment"> /**</span> <a name="l00865"></a>00865 <span class="comment"> * Constructor from two points, through which the line will pass.</span> <a name="l00866"></a>00866 <span class="comment"> * \throw logic_error if both points are the same</span> <a name="l00867"></a>00867 <span class="comment"> */</span> <a name="l00868"></a>00868 <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p2) <span class="keywordflow">throw</span>(<a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>);<span class="comment"></span> <a name="l00869"></a>00869 <span class="comment"> /**</span> <a name="l00870"></a>00870 <span class="comment"> * Constructor from a segment.</span> <a name="l00871"></a>00871 <span class="comment"> */</span> <a name="l00872"></a>00872 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s);<span class="comment"></span> <a name="l00873"></a>00873 <span class="comment"> /**</span> <a name="l00874"></a>00874 <span class="comment"> * Fast default constructor. Initializes to garbage.</span> <a name="l00875"></a>00875 <span class="comment"> */</span> <a name="l00876"></a><a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a2bf63eda14216acb0d9a5cd2fd95970c">00876</a> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a2bf63eda14216acb0d9a5cd2fd95970c" title="Fast default constructor.">TLine2D</a>() {}<span class="comment"></span> <a name="l00877"></a>00877 <span class="comment"> /**</span> <a name="l00878"></a>00878 <span class="comment"> * Constructor from line's coefficients.</span> <a name="l00879"></a>00879 <span class="comment"> */</span> <a name="l00880"></a><a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#afbd73de8446c7dc7ab3dbcdd5499dfb4">00880</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#afbd73de8446c7dc7ab3dbcdd5499dfb4" title="Constructor from line's coefficients.">TLine2D</a>(<span class="keywordtype">double</span> A,<span class="keywordtype">double</span> B,<span class="keywordtype">double</span> C) { <a name="l00881"></a>00881 coefs[0]=A; <a name="l00882"></a>00882 coefs[1]=B; <a name="l00883"></a>00883 coefs[2]=C; <a name="l00884"></a>00884 }<span class="comment"></span> <a name="l00885"></a>00885 <span class="comment"> /**</span> <a name="l00886"></a>00886 <span class="comment"> * Construction from 3D object, discarding the Z.</span> <a name="l00887"></a>00887 <span class="comment"> * \throw std::logic_error if the line is normal to the XY plane.</span> <a name="l00888"></a>00888 <span class="comment"> */</span> <a name="l00889"></a>00889 <span class="keyword">explicit</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &l); <a name="l00890"></a>00890 }; <a name="l00891"></a>00891 <span class="comment"></span> <a name="l00892"></a>00892 <span class="comment"> /**</span> <a name="l00893"></a>00893 <span class="comment"> * 3D line, represented by a base point and a director vector.</span> <a name="l00894"></a>00894 <span class="comment"> * \sa TLine2D,TSegment3D,TPlane,TPolygon3D,TPoint3D</span> <a name="l00895"></a>00895 <span class="comment"> */</span> <a name="l00896"></a>00896 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> { <a name="l00897"></a>00897 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00898"></a>00898 <span class="comment"> /**</span> <a name="l00899"></a>00899 <span class="comment"> * Base point.</span> <a name="l00900"></a>00900 <span class="comment"> */</span> <a name="l00901"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad82681ef5a27b2bd32e29961f2bf3ec4">00901</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad82681ef5a27b2bd32e29961f2bf3ec4" title="Base point.">pBase</a>;<span class="comment"></span> <a name="l00902"></a>00902 <span class="comment"> /**</span> <a name="l00903"></a>00903 <span class="comment"> * Director vector.</span> <a name="l00904"></a>00904 <span class="comment"> */</span> <a name="l00905"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe">00905</a> <span class="keywordtype">double</span> director[3];<span class="comment"></span> <a name="l00906"></a>00906 <span class="comment"> /**</span> <a name="l00907"></a>00907 <span class="comment"> * Check whether a point is inside the line.</span> <a name="l00908"></a>00908 <span class="comment"> */</span> <a name="l00909"></a>00909 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00910"></a>00910 <span class="comment"> /**</span> <a name="l00911"></a>00911 <span class="comment"> * Distance between the line and a point.</span> <a name="l00912"></a>00912 <span class="comment"> */</span> <a name="l00913"></a>00913 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00914"></a>00914 <span class="comment"> /**</span> <a name="l00915"></a>00915 <span class="comment"> * Unitarize director vector.</span> <a name="l00916"></a>00916 <span class="comment"> */</span> <a name="l00917"></a>00917 <span class="keywordtype">void</span> unitarize();<span class="comment"></span> <a name="l00918"></a>00918 <span class="comment"> /**</span> <a name="l00919"></a>00919 <span class="comment"> * Get director vector.</span> <a name="l00920"></a>00920 <span class="comment"> */</span> <a name="l00921"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a9bafeb5d9c3b5b266270728e2c2ad8e5">00921</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a9bafeb5d9c3b5b266270728e2c2ad8e5" title="Get director vector.">getDirectorVector</a>(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[3])<span class="keyword"> const </span>{ <a name="l00922"></a>00922 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<3;i++) <a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>[i]=director[i]; <a name="l00923"></a>00923 }<span class="comment"></span> <a name="l00924"></a>00924 <span class="comment"> /**</span> <a name="l00925"></a>00925 <span class="comment"> * Unitarize and then get director vector.</span> <a name="l00926"></a>00926 <span class="comment"> */</span> <a name="l00927"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad576c07105cd8e221c4705d1f01ff0a9">00927</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad576c07105cd8e221c4705d1f01ff0a9" title="Unitarize and then get director vector.">getUnitaryDirectorVector</a>(<span class="keywordtype">double</span> (&<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>)[3]) { <a name="l00928"></a>00928 unitarize(); <a name="l00929"></a>00929 getDirectorVector(<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a>); <a name="l00930"></a>00930 }<span class="comment"></span> <a name="l00931"></a>00931 <span class="comment"> /**</span> <a name="l00932"></a>00932 <span class="comment"> * Project into 2D space, discarding the Z coordinate.</span> <a name="l00933"></a>00933 <span class="comment"> * \throw std::logic_error if the line's director vector is orthogonal to the XY plane.</span> <a name="l00934"></a>00934 <span class="comment"> */</span> <a name="l00935"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a90e4ea92b1403dac1390ccf3aded31c9">00935</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a90e4ea92b1403dac1390ccf3aded31c9" title="Project into 2D space, discarding the Z coordinate.">generate2DObject</a>(<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &l)<span class="keyword"> const </span>{ <a name="l00936"></a>00936 l=<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(*<span class="keyword">this</span>); <a name="l00937"></a>00937 }<span class="comment"></span> <a name="l00938"></a>00938 <span class="comment"> /**</span> <a name="l00939"></a>00939 <span class="comment"> * Constructor from two points, through which the line will pass.</span> <a name="l00940"></a>00940 <span class="comment"> * \throw std::logic_error if both points are the same.</span> <a name="l00941"></a>00941 <span class="comment"> */</span> <a name="l00942"></a>00942 <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(<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="keywordflow">throw</span>(<a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>);<span class="comment"></span> <a name="l00943"></a>00943 <span class="comment"> /**</span> <a name="l00944"></a>00944 <span class="comment"> * Constructor from 3D segment.</span> <a name="l00945"></a>00945 <span class="comment"> */</span> <a name="l00946"></a>00946 <span class="keyword">explicit</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s);<span class="comment"></span> <a name="l00947"></a>00947 <span class="comment"> /**</span> <a name="l00948"></a>00948 <span class="comment"> * Fast default constructor. Initializes to garbage.</span> <a name="l00949"></a>00949 <span class="comment"> */</span> <a name="l00950"></a><a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a0665ebd41d4154fb90383003c1a0245d">00950</a> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a0665ebd41d4154fb90383003c1a0245d" title="Fast default constructor.">TLine3D</a>() {}<span class="comment"></span> <a name="l00951"></a>00951 <span class="comment"> /**</span> <a name="l00952"></a>00952 <span class="comment"> * Implicit constructor from 2D object. Zeroes the z.</span> <a name="l00953"></a>00953 <span class="comment"> */</span> <a name="l00954"></a>00954 <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &l); <a name="l00955"></a>00955 }; <a name="l00956"></a>00956 <span class="comment"></span> <a name="l00957"></a>00957 <span class="comment"> /**</span> <a name="l00958"></a>00958 <span class="comment"> * 3D Plane, represented by its equation \f$Ax+By+Cz+D=0\f$</span> <a name="l00959"></a>00959 <span class="comment"> * \sa TSegment3D,TLine3D,TPolygon3D,TPoint3D</span> <a name="l00960"></a>00960 <span class="comment"> */</span> <a name="l00961"></a>00961 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPlane { <a name="l00962"></a>00962 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00963"></a>00963 <span class="comment"> /**</span> <a name="l00964"></a>00964 <span class="comment"> * Plane coefficients, stored as an array: \f$\left[A,B,C,D\right]\f$</span> <a name="l00965"></a>00965 <span class="comment"> */</span> <a name="l00966"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9">00966</a> <span class="keywordtype">double</span> coefs[4];<span class="comment"></span> <a name="l00967"></a>00967 <span class="comment"> /**</span> <a name="l00968"></a>00968 <span class="comment"> * Evaluate a point in the plane's equation.</span> <a name="l00969"></a>00969 <span class="comment"> */</span> <a name="l00970"></a>00970 <span class="keywordtype">double</span> evaluatePoint(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00971"></a>00971 <span class="comment"> /**</span> <a name="l00972"></a>00972 <span class="comment"> * Check whether a point is contained into the plane.</span> <a name="l00973"></a>00973 <span class="comment"> */</span> <a name="l00974"></a>00974 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00975"></a>00975 <span class="comment"> /**</span> <a name="l00976"></a>00976 <span class="comment"> * Check whether a segment is fully contained into the plane.</span> <a name="l00977"></a>00977 <span class="comment"> */</span> <a name="l00978"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#af57c08d8739db38ad1fe0531ace3926a">00978</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#af57c08d8739db38ad1fe0531ace3926a" title="Check whether a segment is fully contained into the plane.">contains</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &segment)<span class="keyword"> const </span>{ <a name="l00979"></a>00979 <span class="keywordflow">return</span> contains(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>)&&contains(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>); <a name="l00980"></a>00980 }<span class="comment"></span> <a name="l00981"></a>00981 <span class="comment"> /**</span> <a name="l00982"></a>00982 <span class="comment"> * Check whether a line is fully contained into the plane.</span> <a name="l00983"></a>00983 <span class="comment"> */</span> <a name="l00984"></a>00984 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &line) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00985"></a>00985 <span class="comment"> /**</span> <a name="l00986"></a>00986 <span class="comment"> * Distance to 3D point.</span> <a name="l00987"></a>00987 <span class="comment"> */</span> <a name="l00988"></a>00988 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00989"></a>00989 <span class="comment"> /**</span> <a name="l00990"></a>00990 <span class="comment"> * Distance to 3D line. Will be zero if the line is not parallel to the plane.</span> <a name="l00991"></a>00991 <span class="comment"> */</span> <a name="l00992"></a>00992 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &line) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00993"></a>00993 <span class="comment"> /**</span> <a name="l00994"></a>00994 <span class="comment"> * Get plane's normal vector.</span> <a name="l00995"></a>00995 <span class="comment"> */</span> <a name="l00996"></a>00996 <span class="keywordtype">void</span> getNormalVector(<span class="keywordtype">double</span> (&vec)[3]) <span class="keyword">const</span>;<span class="comment"></span> <a name="l00997"></a>00997 <span class="comment"> /**</span> <a name="l00998"></a>00998 <span class="comment"> * Unitarize normal vector.</span> <a name="l00999"></a>00999 <span class="comment"> */</span> <a name="l01000"></a>01000 <span class="keywordtype">void</span> unitarize();<span class="comment"></span> <a name="l01001"></a>01001 <span class="comment"> /**</span> <a name="l01002"></a>01002 <span class="comment"> * Unitarize, then get normal vector.</span> <a name="l01003"></a>01003 <span class="comment"> */</span> <a name="l01004"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a7e4be995b298d7b331933ed2c405ba8a">01004</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a7e4be995b298d7b331933ed2c405ba8a" title="Unitarize, then get normal vector.">getUnitaryNormalVector</a>(<span class="keywordtype">double</span> (&vec)[3]) { <a name="l01005"></a>01005 unitarize(); <a name="l01006"></a>01006 getNormalVector(vec); <a name="l01007"></a>01007 }<span class="comment"></span> <a name="l01008"></a>01008 <span class="comment"> /**</span> <a name="l01009"></a>01009 <span class="comment"> * Gets a pose whose XY plane corresponds to this plane.</span> <a name="l01010"></a>01010 <span class="comment"> */</span> <a name="l01011"></a>01011 <span class="keywordtype">void</span> getAsPose3D(<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> &outPose);<span class="comment"></span> <a name="l01012"></a>01012 <span class="comment"> /**</span> <a name="l01013"></a>01013 <span class="comment"> * Gets a pose whose XY plane corresponds to this plane.</span> <a name="l01014"></a>01014 <span class="comment"> */</span> <a name="l01015"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a998607e39760859d2ef8f9e8330d0282">01015</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a998607e39760859d2ef8f9e8330d0282" title="Gets a pose whose XY plane corresponds to this plane.">getAsPose3D</a>(<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> &outPose)<span class="keyword"> const </span>{ <a name="l01016"></a>01016 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> p=*<span class="keyword">this</span>; <a name="l01017"></a>01017 p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a84a6723ba59a4095d77c60e6f281223c" title="Gets a pose whose XY plane corresponds to this plane.">getAsPose3D</a>(outPose); <a name="l01018"></a>01018 }<span class="comment"></span> <a name="l01019"></a>01019 <span class="comment"> /**</span> <a name="l01020"></a>01020 <span class="comment"> * Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates.</span> <a name="l01021"></a>01021 <span class="comment"> * \throw std::logic_error if the point is not inside the plane.</span> <a name="l01022"></a>01022 <span class="comment"> */</span> <a name="l01023"></a>01023 <span class="keywordtype">void</span> getAsPose3DForcingOrigin(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &newOrigin,<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> &pose);<span class="comment"></span> <a name="l01024"></a>01024 <span class="comment"> /**</span> <a name="l01025"></a>01025 <span class="comment"> * Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates.</span> <a name="l01026"></a>01026 <span class="comment"> * \throw std::logic_error if the point is not inside the plane.</span> <a name="l01027"></a>01027 <span class="comment"> */</span> <a name="l01028"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa84e3a2455e945635f78c0726202db38">01028</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa84e3a2455e945635f78c0726202db38" title="Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates...">getAsPose3DForcingOrigin</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &newOrigin,<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> &pose)<span class="keyword"> const </span>{ <a name="l01029"></a>01029 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> p=*<span class="keyword">this</span>; <a name="l01030"></a>01030 p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a9a1508e9f4eff2405dd023eb4fd1915e" title="Gets a pose whose XY plane corresponds to this, forcing an exact point as its spatial coordinates...">getAsPose3DForcingOrigin</a>(newOrigin,pose); <a name="l01031"></a>01031 }<span class="comment"></span> <a name="l01032"></a>01032 <span class="comment"> /**</span> <a name="l01033"></a>01033 <span class="comment"> * Gets a plane which contains these three points.</span> <a name="l01034"></a>01034 <span class="comment"> * \throw std::logic_error if the points are linearly dependants.</span> <a name="l01035"></a>01035 <span class="comment"> */</span> <a name="l01036"></a>01036 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a>(<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="keywordflow">throw</span>(<a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>);<span class="comment"></span> <a name="l01037"></a>01037 <span class="comment"> /**</span> <a name="l01038"></a>01038 <span class="comment"> * Gets a plane which contains this point and this line.</span> <a name="l01039"></a>01039 <span class="comment"> * \throw std::logic_error if the point is inside the line.</span> <a name="l01040"></a>01040 <span class="comment"> */</span> <a name="l01041"></a>01041 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a>(<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_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &r2) <span class="keywordflow">throw</span>(<a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>);<span class="comment"></span> <a name="l01042"></a>01042 <span class="comment"> /**</span> <a name="l01043"></a>01043 <span class="comment"> * Gets a plane which contains the two lines.</span> <a name="l01044"></a>01044 <span class="comment"> * \throw std::logic_error if the lines do not cross.</span> <a name="l01045"></a>01045 <span class="comment"> */</span> <a name="l01046"></a>01046 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &r1,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &r2) <span class="keywordflow">throw</span>(<a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>);<span class="comment"></span> <a name="l01047"></a>01047 <span class="comment"> /**</span> <a name="l01048"></a>01048 <span class="comment"> * Fast default constructor. Initializes to garbage.</span> <a name="l01049"></a>01049 <span class="comment"> */</span> <a name="l01050"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a3b1f5dc8cf220e5c698c835f4685b1de">01050</a> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#a3b1f5dc8cf220e5c698c835f4685b1de" title="Fast default constructor.">TPlane</a>() {}<span class="comment"></span> <a name="l01051"></a>01051 <span class="comment"> /**</span> <a name="l01052"></a>01052 <span class="comment"> * Constructor from plane coefficients.</span> <a name="l01053"></a>01053 <span class="comment"> */</span> <a name="l01054"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#acbcc5ccd6013d00092e5ac9dc9fa9a57">01054</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#acbcc5ccd6013d00092e5ac9dc9fa9a57" title="Constructor from plane coefficients.">TPlane</a>(<span class="keywordtype">double</span> A,<span class="keywordtype">double</span> B,<span class="keywordtype">double</span> C,<span class="keywordtype">double</span> D) { <a name="l01055"></a>01055 coefs[0]=A; <a name="l01056"></a>01056 coefs[1]=B; <a name="l01057"></a>01057 coefs[2]=C; <a name="l01058"></a>01058 coefs[3]=D; <a name="l01059"></a>01059 }<span class="comment"></span> <a name="l01060"></a>01060 <span class="comment"> /**</span> <a name="l01061"></a>01061 <span class="comment"> * Constructor from an array of coefficients.</span> <a name="l01062"></a>01062 <span class="comment"> */</span> <a name="l01063"></a><a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa291f61514c3b453a2a4f0b89374a29e">01063</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa291f61514c3b453a2a4f0b89374a29e" title="Constructor from an array of coefficients.">TPlane</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> (&vec)[4]) { <a name="l01064"></a>01064 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<4;i++) coefs[i]=vec[i]; <a name="l01065"></a>01065 } <a name="l01066"></a>01066 }; <a name="l01067"></a>01067 <a name="l01068"></a><a class="code" href="group__geometry__grp.html#ga059f9e940d0d3c842d7ca1cec3c4f999">01068</a> <span class="keyword">typedef</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> <a class="code" href="group__geometry__grp.html#ga059f9e940d0d3c842d7ca1cec3c4f999">TPlane3D</a>; <a name="l01069"></a>01069 <span class="comment"></span> <a name="l01070"></a>01070 <span class="comment"> /**</span> <a name="l01071"></a>01071 <span class="comment"> * 2D polygon, inheriting from std::vector<TPoint2D>.</span> <a name="l01072"></a>01072 <span class="comment"> * \sa TPolygon3D,TSegment2D,TLine2D,TPoint2D, CPolygon</span> <a name="l01073"></a>01073 <span class="comment"> */</span> <a name="l01074"></a>01074 <span class="keyword">class </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>:<span class="keyword">public</span> std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><TPoint2D> { <a name="l01075"></a>01075 <span class="keyword">public</span>:<span class="comment"></span> <a name="l01076"></a>01076 <span class="comment"> /**</span> <a name="l01077"></a>01077 <span class="comment"> * Distance to a point.</span> <a name="l01078"></a>01078 <span class="comment"> */</span> <a name="l01079"></a>01079 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01080"></a>01080 <span class="comment"> /**</span> <a name="l01081"></a>01081 <span class="comment"> * Check whether a point is inside the polygon.</span> <a name="l01082"></a>01082 <span class="comment"> */</span> <a name="l01083"></a>01083 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01084"></a>01084 <span class="comment"> /**</span> <a name="l01085"></a>01085 <span class="comment"> * Gets as set of segments, instead of points.</span> <a name="l01086"></a>01086 <span class="comment"> */</span> <a name="l01087"></a>01087 <span class="keywordtype">void</span> getAsSegmentList(<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TSegment2D></a> &v) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01088"></a>01088 <span class="comment"> /**</span> <a name="l01089"></a>01089 <span class="comment"> * Projects into 3D space, zeroing the z.</span> <a name="l01090"></a>01090 <span class="comment"> */</span> <a name="l01091"></a>01091 <span class="keywordtype">void</span> generate3DObject(<a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01092"></a>01092 <span class="comment"> /**</span> <a name="l01093"></a>01093 <span class="comment"> * Polygon's central point.</span> <a name="l01094"></a>01094 <span class="comment"> */</span> <a name="l01095"></a>01095 <span class="keywordtype">void</span> getCenter(<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01096"></a>01096 <span class="comment"> /**</span> <a name="l01097"></a>01097 <span class="comment"> * Checks whether is convex.</span> <a name="l01098"></a>01098 <span class="comment"> */</span> <a name="l01099"></a>01099 <span class="keywordtype">bool</span> isConvex() <span class="keyword">const</span>;<span class="comment"></span> <a name="l01100"></a>01100 <span class="comment"> /**</span> <a name="l01101"></a>01101 <span class="comment"> * Erase repeated vertices.</span> <a name="l01102"></a>01102 <span class="comment"> * \sa removeRedundantVertices</span> <a name="l01103"></a>01103 <span class="comment"> */</span> <a name="l01104"></a>01104 <span class="keywordtype">void</span> removeRepeatedVertices();<span class="comment"></span> <a name="l01105"></a>01105 <span class="comment"> /**</span> <a name="l01106"></a>01106 <span class="comment"> * Erase every redundant vertex from the polygon, saving space.</span> <a name="l01107"></a>01107 <span class="comment"> * \sa removeRepeatedVertices</span> <a name="l01108"></a>01108 <span class="comment"> */</span> <a name="l01109"></a>01109 <span class="keywordtype">void</span> removeRedundantVertices();<span class="comment"></span> <a name="l01110"></a>01110 <span class="comment"> /**</span> <a name="l01111"></a>01111 <span class="comment"> * Gets plot data, ready to use on a 2D plot.</span> <a name="l01112"></a>01112 <span class="comment"> * \sa mrpt::gui::CDisplayWindowPlots</span> <a name="l01113"></a>01113 <span class="comment"> */</span> <a name="l01114"></a>01114 <span class="keywordtype">void</span> getPlotData(<a class="code" href="classstd_1_1vector.html">std::vector<double></a> &x,<a class="code" href="classstd_1_1vector.html">std::vector<double></a> &<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01115"></a>01115 <span class="comment"> /**</span> <a name="l01116"></a>01116 <span class="comment"> * Default constructor.</span> <a name="l01117"></a>01117 <span class="comment"> */</span> <a name="l01118"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#a192bf89d25262a4ca42201f2f4dd2378">01118</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#a192bf89d25262a4ca42201f2f4dd2378" title="Default constructor.">TPolygon2D</a>():std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>>() {}<span class="comment"></span> <a name="l01119"></a>01119 <span class="comment"> /**</span> <a name="l01120"></a>01120 <span class="comment"> * Constructor for a given number of vertices, intializing them as garbage.</span> <a name="l01121"></a>01121 <span class="comment"> */</span> <a name="l01122"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#ac5e11873df6c315640aa2e5bc26409be">01122</a> <span class="keyword">explicit</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#ac5e11873df6c315640aa2e5bc26409be" title="Constructor for a given number of vertices, intializing them as garbage.">TPolygon2D</a>(<span class="keywordtype">size_t</span> N):std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>>(N) {}<span class="comment"></span> <a name="l01123"></a>01123 <span class="comment"> /**</span> <a name="l01124"></a>01124 <span class="comment"> * Implicit constructor from a vector of 2D points.</span> <a name="l01125"></a>01125 <span class="comment"> */</span> <a name="l01126"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#a167da838187ef5c7fdc5bdfc65ff1818">01126</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html#a167da838187ef5c7fdc5bdfc65ff1818" title="Implicit constructor from a vector of 2D points.">TPolygon2D</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &v):std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>>(v) {}<span class="comment"></span> <a name="l01127"></a>01127 <span class="comment"> /**</span> <a name="l01128"></a>01128 <span class="comment"> * Constructor from a 3D object.</span> <a name="l01129"></a>01129 <span class="comment"> */</span> <a name="l01130"></a>01130 <span class="keyword">explicit</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p);<span class="comment"></span> <a name="l01131"></a>01131 <span class="comment"> /**</span> <a name="l01132"></a>01132 <span class="comment"> * Static method to create a regular polygon, given its size and radius.</span> <a name="l01133"></a>01133 <span class="comment"> * \throw std::logic_error if radius is near zero or the number of edges is less than three.</span> <a name="l01134"></a>01134 <span class="comment"> */</span> <a name="l01135"></a>01135 <span class="keyword">static</span> <span class="keywordtype">void</span> createRegularPolygon(<span class="keywordtype">size_t</span> numEdges,<span class="keywordtype">double</span> radius,<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &poly);<span class="comment"></span> <a name="l01136"></a>01136 <span class="comment"> /**</span> <a name="l01137"></a>01137 <span class="comment"> * Static method to create a regular polygon from its size and radius. The center will correspond to the given pose.</span> <a name="l01138"></a>01138 <span class="comment"> * \throw std::logic_error if radius is near zero or the number of edges is less than three.</span> <a name="l01139"></a>01139 <span class="comment"> */</span> <a name="l01140"></a>01140 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> createRegularPolygon(<span class="keywordtype">size_t</span> numEdges,<span class="keywordtype">double</span> radius,<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &poly,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">mrpt::poses::CPose2D</a> &pose); <a name="l01141"></a>01141 }; <a name="l01142"></a>01142 <span class="comment"></span> <a name="l01143"></a>01143 <span class="comment"> /**</span> <a name="l01144"></a>01144 <span class="comment"> * 3D polygon, inheriting from std::vector<TPoint3D></span> <a name="l01145"></a>01145 <span class="comment"> * \sa TPolygon2D,TSegment3D,TLine3D,TPlane,TPoint3D</span> <a name="l01146"></a>01146 <span class="comment"> */</span> <a name="l01147"></a>01147 <span class="keyword">class </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>:<span class="keyword">public</span> std::vector<TPoint3D> { <a name="l01148"></a>01148 <span class="keyword">public</span>:<span class="comment"></span> <a name="l01149"></a>01149 <span class="comment"> /**</span> <a name="l01150"></a>01150 <span class="comment"> * Distance to point.</span> <a name="l01151"></a>01151 <span class="comment"> */</span> <a name="l01152"></a>01152 <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPoint3D &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01153"></a>01153 <span class="comment"> /**</span> <a name="l01154"></a>01154 <span class="comment"> * Check whether a point is inside the polygon.</span> <a name="l01155"></a>01155 <span class="comment"> */</span> <a name="l01156"></a>01156 <span class="keywordtype">bool</span> contains(<span class="keyword">const</span> TPoint3D &point) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01157"></a>01157 <span class="comment"> /**</span> <a name="l01158"></a>01158 <span class="comment"> * Gets as set of segments, instead of set of points.</span> <a name="l01159"></a>01159 <span class="comment"> */</span> <a name="l01160"></a>01160 <span class="keywordtype">void</span> getAsSegmentList(<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &v) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01161"></a>01161 <span class="comment"> /**</span> <a name="l01162"></a>01162 <span class="comment"> * Gets a plane which contains the polygon. Returns false if the polygon is skew and cannot be fit inside a plane.</span> <a name="l01163"></a>01163 <span class="comment"> */</span> <a name="l01164"></a>01164 <span class="keywordtype">bool</span> getPlane(TPlane &p) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01165"></a>01165 <span class="comment"> /**</span> <a name="l01166"></a>01166 <span class="comment"> * Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.</span> <a name="l01167"></a>01167 <span class="comment"> * \sa getBestFittingPlane</span> <a name="l01168"></a>01168 <span class="comment"> */</span> <a name="l01169"></a>01169 <span class="keywordtype">void</span> getBestFittingPlane(TPlane &p) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01170"></a>01170 <span class="comment"> /**</span> <a name="l01171"></a>01171 <span class="comment"> * Projects into a 2D space, discarding the z.</span> <a name="l01172"></a>01172 <span class="comment"> * \get getPlane,isSkew</span> <a name="l01173"></a>01173 <span class="comment"> */</span> <a name="l01174"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a4209a7967588128b36b73b04a18d36eb">01174</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a4209a7967588128b36b73b04a18d36eb" title="Projects into a 2D space, discarding the z.">generate2DObject</a>(<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p)<span class="keyword"> const </span>{ <a name="l01175"></a>01175 p=<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(*<span class="keyword">this</span>); <a name="l01176"></a>01176 }<span class="comment"></span> <a name="l01177"></a>01177 <span class="comment"> /**</span> <a name="l01178"></a>01178 <span class="comment"> * Get polygon's central point.</span> <a name="l01179"></a>01179 <span class="comment"> */</span> <a name="l01180"></a>01180 <span class="keywordtype">void</span> getCenter(<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01181"></a>01181 <span class="comment"> /**</span> <a name="l01182"></a>01182 <span class="comment"> * Check whether the polygon is skew. Returns true if there doesn't exist a plane in which the polygon can fit.</span> <a name="l01183"></a>01183 <span class="comment"> * \sa getBestFittingPlane</span> <a name="l01184"></a>01184 <span class="comment"> */</span> <a name="l01185"></a>01185 <span class="keywordtype">bool</span> isSkew() <span class="keyword">const</span>;<span class="comment"></span> <a name="l01186"></a>01186 <span class="comment"> /**</span> <a name="l01187"></a>01187 <span class="comment"> * Remove polygon's repeated vertices.</span> <a name="l01188"></a>01188 <span class="comment"> */</span> <a name="l01189"></a>01189 <span class="keywordtype">void</span> removeRepeatedVertices();<span class="comment"></span> <a name="l01190"></a>01190 <span class="comment"> /**</span> <a name="l01191"></a>01191 <span class="comment"> * Erase every redundant vertex, thus saving space.</span> <a name="l01192"></a>01192 <span class="comment"> */</span> <a name="l01193"></a>01193 <span class="keywordtype">void</span> removeRedundantVertices();<span class="comment"></span> <a name="l01194"></a>01194 <span class="comment"> /**</span> <a name="l01195"></a>01195 <span class="comment"> * Default constructor. Creates a polygon with no vertices.</span> <a name="l01196"></a>01196 <span class="comment"> */</span> <a name="l01197"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a07f012fced83cde548f8b822e93a6fd1">01197</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a07f012fced83cde548f8b822e93a6fd1" title="Default constructor.">TPolygon3D</a>():std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>>() {}<span class="comment"></span> <a name="l01198"></a>01198 <span class="comment"> /**</span> <a name="l01199"></a>01199 <span class="comment"> * Constructor for a given size. Creates a polygon with a fixed number of vertices, which are initialized to garbage.</span> <a name="l01200"></a>01200 <span class="comment"> */</span> <a name="l01201"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a99f35e3f32c78eaa551221826754bfff">01201</a> <span class="keyword">explicit</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a99f35e3f32c78eaa551221826754bfff" title="Constructor for a given size.">TPolygon3D</a>(<span class="keywordtype">size_t</span> N):std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>>(N) {}<span class="comment"></span> <a name="l01202"></a>01202 <span class="comment"> /**</span> <a name="l01203"></a>01203 <span class="comment"> * Implicit constructor from a 3D points vector.</span> <a name="l01204"></a>01204 <span class="comment"> */</span> <a name="l01205"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a8de8639b3e64863d83a8d2b777a499a3">01205</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html#a8de8639b3e64863d83a8d2b777a499a3" title="Implicit constructor from a 3D points vector.">TPolygon3D</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &v):std::<a class="code" href="classstd_1_1vector.html" title="STL class.">vector</a><<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a>>(v) {}<span class="comment"></span> <a name="l01206"></a>01206 <span class="comment"> /**</span> <a name="l01207"></a>01207 <span class="comment"> * Constructor from a 2D object. Zeroes the z.</span> <a name="l01208"></a>01208 <span class="comment"> */</span> <a name="l01209"></a>01209 <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p);<span class="comment"></span> <a name="l01210"></a>01210 <span class="comment"> /**</span> <a name="l01211"></a>01211 <span class="comment"> * Static method to create a regular polygon, given its size and radius.</span> <a name="l01212"></a>01212 <span class="comment"> * \throw std::logic_error if number of edges is less than three, or radius is near zero.</span> <a name="l01213"></a>01213 <span class="comment"> */</span> <a name="l01214"></a>01214 <span class="keyword">static</span> <span class="keywordtype">void</span> createRegularPolygon(<span class="keywordtype">size_t</span> numEdges,<span class="keywordtype">double</span> radius,<a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &poly);<span class="comment"></span> <a name="l01215"></a>01215 <span class="comment"> /**</span> <a name="l01216"></a>01216 <span class="comment"> * Static method to create a regular polygon, given its size and radius. The center will be located on the given pose.</span> <a name="l01217"></a>01217 <span class="comment"> * \throw std::logic_error if number of edges is less than three, or radius is near zero.</span> <a name="l01218"></a>01218 <span class="comment"> */</span> <a name="l01219"></a>01219 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> createRegularPolygon(<span class="keywordtype">size_t</span> numEdges,<span class="keywordtype">double</span> radius,<a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &poly,<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> &pose); <a name="l01220"></a>01220 }; <a name="l01221"></a>01221 <span class="comment"></span> <a name="l01222"></a>01222 <span class="comment"> /**</span> <a name="l01223"></a>01223 <span class="comment"> * Object type identifier for TPoint2D or TPoint3D.</span> <a name="l01224"></a>01224 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l01225"></a>01225 <span class="comment"> */</span> <a name="l01226"></a><a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52">01226</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>=0;<span class="comment"></span> <a name="l01227"></a>01227 <span class="comment"> /**</span> <a name="l01228"></a>01228 <span class="comment"> * Object type identifier for TSegment2D or TSegment3D.</span> <a name="l01229"></a>01229 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l01230"></a>01230 <span class="comment"> */</span> <a name="l01231"></a><a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc">01231</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>=1;<span class="comment"></span> <a name="l01232"></a>01232 <span class="comment"> /**</span> <a name="l01233"></a>01233 <span class="comment"> * Object type identifier for TLine2D or TLine3D.</span> <a name="l01234"></a>01234 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l01235"></a>01235 <span class="comment"> */</span> <a name="l01236"></a><a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e">01236</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>=2;<span class="comment"></span> <a name="l01237"></a>01237 <span class="comment"> /**</span> <a name="l01238"></a>01238 <span class="comment"> * Object type identifier for TPolygon2D or TPolygon3D.</span> <a name="l01239"></a>01239 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l01240"></a>01240 <span class="comment"> */</span> <a name="l01241"></a><a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64">01241</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>=3;<span class="comment"></span> <a name="l01242"></a>01242 <span class="comment"> /**</span> <a name="l01243"></a>01243 <span class="comment"> * Object type identifier for TPlane.</span> <a name="l01244"></a>01244 <span class="comment"> * \sa TObject3D</span> <a name="l01245"></a>01245 <span class="comment"> */</span> <a name="l01246"></a><a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd">01246</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>=4;<span class="comment"></span> <a name="l01247"></a>01247 <span class="comment"> /**</span> <a name="l01248"></a>01248 <span class="comment"> * Object type identifier for empty TObject2D or TObject3D.</span> <a name="l01249"></a>01249 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l01250"></a>01250 <span class="comment"> */</span> <a name="l01251"></a><a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a">01251</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>=255; <a name="l01252"></a>01252 <span class="comment"></span> <a name="l01253"></a>01253 <span class="comment"> /**</span> <a name="l01254"></a>01254 <span class="comment"> * Standard type for storing any lightweight 2D type. Do not inherit from this class.</span> <a name="l01255"></a>01255 <span class="comment"> * \sa TPoint2D,TSegment2D,TLine2D,TPolygon2D</span> <a name="l01256"></a>01256 <span class="comment"> */</span> <a name="l01257"></a>01257 <span class="preprocessor">#ifdef TOBJECTS_USE_UNIONS</span> <a name="l01258"></a>01258 <span class="preprocessor"></span> <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> { <a name="l01259"></a>01259 <span class="keyword">private</span>:<span class="comment"></span> <a name="l01260"></a>01260 <span class="comment"> /**</span> <a name="l01261"></a>01261 <span class="comment"> * Object type identifier.</span> <a name="l01262"></a>01262 <span class="comment"> */</span> <a name="l01263"></a>01263 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> type;<span class="comment"></span> <a name="l01264"></a>01264 <span class="comment"> /**</span> <a name="l01265"></a>01265 <span class="comment"> * Union type storing pointers to every allowed type.</span> <a name="l01266"></a>01266 <span class="comment"> */</span> <a name="l01267"></a>01267 <span class="keyword">union </span>{ <a name="l01268"></a>01268 <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> *point; <a name="l01269"></a>01269 <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> *segment; <a name="l01270"></a>01270 <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> *line; <a name="l01271"></a>01271 <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> *polygon; <a name="l01272"></a>01272 } data;<span class="comment"></span> <a name="l01273"></a>01273 <span class="comment"> /**</span> <a name="l01274"></a>01274 <span class="comment"> * Destroys the object, releasing the pointer to the content (if any).</span> <a name="l01275"></a>01275 <span class="comment"> */</span> <a name="l01276"></a>01276 <span class="keywordtype">void</span> destroy() { <a name="l01277"></a>01277 <span class="keywordflow">switch</span>(type) { <a name="l01278"></a>01278 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01279"></a>01279 <span class="keyword">delete</span> data.point; <a name="l01280"></a>01280 <span class="keywordflow">break</span>; <a name="l01281"></a>01281 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01282"></a>01282 <span class="keyword">delete</span> data.segment; <a name="l01283"></a>01283 <span class="keywordflow">break</span>; <a name="l01284"></a>01284 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01285"></a>01285 <span class="keyword">delete</span> data.line; <a name="l01286"></a>01286 <span class="keywordflow">break</span>; <a name="l01287"></a>01287 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01288"></a>01288 <span class="keyword">delete</span> data.polygon; <a name="l01289"></a>01289 <span class="keywordflow">break</span>; <a name="l01290"></a>01290 } <a name="l01291"></a>01291 type=<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>; <a name="l01292"></a>01292 } <a name="l01293"></a>01293 <span class="keyword">public</span>:<span class="comment"></span> <a name="l01294"></a>01294 <span class="comment"> /**</span> <a name="l01295"></a>01295 <span class="comment"> * Implicit constructor from point.</span> <a name="l01296"></a>01296 <span class="comment"> */</span> <a name="l01297"></a>01297 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>) { <a name="l01298"></a>01298 data.point=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(p); <a name="l01299"></a>01299 }<span class="comment"></span> <a name="l01300"></a>01300 <span class="comment"> /**</span> <a name="l01301"></a>01301 <span class="comment"> * Implicit constructor from segment.</span> <a name="l01302"></a>01302 <span class="comment"> */</span> <a name="l01303"></a>01303 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s):type(<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>) { <a name="l01304"></a>01304 data.segment=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(s); <a name="l01305"></a>01305 }<span class="comment"></span> <a name="l01306"></a>01306 <span class="comment"> /**</span> <a name="l01307"></a>01307 <span class="comment"> * Implicit constructor from line.</span> <a name="l01308"></a>01308 <span class="comment"> */</span> <a name="l01309"></a>01309 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &r):type(<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>) { <a name="l01310"></a>01310 data.line=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(r); <a name="l01311"></a>01311 }<span class="comment"></span> <a name="l01312"></a>01312 <span class="comment"> /**</span> <a name="l01313"></a>01313 <span class="comment"> * Implicit constructor from polygon.</span> <a name="l01314"></a>01314 <span class="comment"> */</span> <a name="l01315"></a>01315 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) { <a name="l01316"></a>01316 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(p); <a name="l01317"></a>01317 }<span class="comment"></span> <a name="l01318"></a>01318 <span class="comment"> /**</span> <a name="l01319"></a>01319 <span class="comment"> * Implicit constructor from polygon.</span> <a name="l01320"></a>01320 <span class="comment"> */</span> <a name="l01321"></a>01321 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>():type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) {}<span class="comment"></span> <a name="l01322"></a>01322 <span class="comment"> /**</span> <a name="l01323"></a>01323 <span class="comment"> * Object destruction.</span> <a name="l01324"></a>01324 <span class="comment"> */</span> <a name="l01325"></a>01325 ~<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>() { <a name="l01326"></a>01326 destroy(); <a name="l01327"></a>01327 }<span class="comment"></span> <a name="l01328"></a>01328 <span class="comment"> /**</span> <a name="l01329"></a>01329 <span class="comment"> * Checks whether content is a point.</span> <a name="l01330"></a>01330 <span class="comment"> */</span> <a name="l01331"></a>01331 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isPoint()<span class="keyword"> const </span>{ <a name="l01332"></a>01332 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01333"></a>01333 }<span class="comment"></span> <a name="l01334"></a>01334 <span class="comment"> /**</span> <a name="l01335"></a>01335 <span class="comment"> * Checks whether content is a segment.</span> <a name="l01336"></a>01336 <span class="comment"> */</span> <a name="l01337"></a>01337 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isSegment()<span class="keyword"> const </span>{ <a name="l01338"></a>01338 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01339"></a>01339 }<span class="comment"></span> <a name="l01340"></a>01340 <span class="comment"> /**</span> <a name="l01341"></a>01341 <span class="comment"> * Checks whether content is a line.</span> <a name="l01342"></a>01342 <span class="comment"> */</span> <a name="l01343"></a>01343 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isLine()<span class="keyword"> const </span>{ <a name="l01344"></a>01344 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01345"></a>01345 }<span class="comment"></span> <a name="l01346"></a>01346 <span class="comment"> /**</span> <a name="l01347"></a>01347 <span class="comment"> * Checks whether content is a polygon.</span> <a name="l01348"></a>01348 <span class="comment"> */</span> <a name="l01349"></a>01349 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isPolygon()<span class="keyword"> const </span>{ <a name="l01350"></a>01350 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01351"></a>01351 }<span class="comment"></span> <a name="l01352"></a>01352 <span class="comment"> /**</span> <a name="l01353"></a>01353 <span class="comment"> * Gets content type.</span> <a name="l01354"></a>01354 <span class="comment"> */</span> <a name="l01355"></a>01355 <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> getType()<span class="keyword"> const </span>{ <a name="l01356"></a>01356 <span class="keywordflow">return</span> type; <a name="l01357"></a>01357 }<span class="comment"></span> <a name="l01358"></a>01358 <span class="comment"> /**</span> <a name="l01359"></a>01359 <span class="comment"> * Gets the content as a point, returning false if the type is inadequate.</span> <a name="l01360"></a>01360 <span class="comment"> */</span> <a name="l01361"></a>01361 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getPoint(<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p)<span class="keyword"> const </span>{ <a name="l01362"></a>01362 <span class="keywordflow">if</span> (isPoint()) { <a name="l01363"></a>01363 p=*(data.point); <a name="l01364"></a>01364 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01365"></a>01365 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01366"></a>01366 }<span class="comment"></span> <a name="l01367"></a>01367 <span class="comment"> /**</span> <a name="l01368"></a>01368 <span class="comment"> * Gets the content as a segment, returning false if the type is inadequate.</span> <a name="l01369"></a>01369 <span class="comment"> */</span> <a name="l01370"></a>01370 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getSegment(<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s)<span class="keyword"> const </span>{ <a name="l01371"></a>01371 <span class="keywordflow">if</span> (isSegment()) { <a name="l01372"></a>01372 s=*(data.segment); <a name="l01373"></a>01373 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01374"></a>01374 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01375"></a>01375 }<span class="comment"></span> <a name="l01376"></a>01376 <span class="comment"> /**</span> <a name="l01377"></a>01377 <span class="comment"> * Gets the content as a line, returning false if the type is inadequate.</span> <a name="l01378"></a>01378 <span class="comment"> */</span> <a name="l01379"></a>01379 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getLine(<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &r)<span class="keyword"> const </span>{ <a name="l01380"></a>01380 <span class="keywordflow">if</span> (isLine()) { <a name="l01381"></a>01381 r=*(data.line); <a name="l01382"></a>01382 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01383"></a>01383 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01384"></a>01384 }<span class="comment"></span> <a name="l01385"></a>01385 <span class="comment"> /**</span> <a name="l01386"></a>01386 <span class="comment"> * Gets the content as a polygon, returning false if the type is inadequate.</span> <a name="l01387"></a>01387 <span class="comment"> */</span> <a name="l01388"></a>01388 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getPolygon(<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p)<span class="keyword"> const </span>{ <a name="l01389"></a>01389 <span class="keywordflow">if</span> (isPolygon()) { <a name="l01390"></a>01390 p=*(data.polygon); <a name="l01391"></a>01391 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01392"></a>01392 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01393"></a>01393 }<span class="comment"></span> <a name="l01394"></a>01394 <span class="comment"> /**</span> <a name="l01395"></a>01395 <span class="comment"> * Assign another TObject2D. Pointers are not shared.</span> <a name="l01396"></a>01396 <span class="comment"> */</span> <a name="l01397"></a>01397 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> &obj) { <a name="l01398"></a>01398 <span class="keywordflow">if</span> (<span class="keyword">this</span>==&obj) <span class="keywordflow">return</span>; <a name="l01399"></a>01399 destroy(); <a name="l01400"></a>01400 <span class="keywordflow">switch</span> (type=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7655cd0519a403e4e4c2393debd6b0da" title="Object type identifier.">type</a>) { <a name="l01401"></a>01401 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01402"></a>01402 data.point=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a639f8f371a97ffba68507854f5bc38e3">point</a>)); <a name="l01403"></a>01403 <span class="keywordflow">break</span>; <a name="l01404"></a>01404 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01405"></a>01405 data.segment=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1bb4e6be37d0ded92003a8354afde2f7">segment</a>)); <a name="l01406"></a>01406 <span class="keywordflow">break</span>; <a name="l01407"></a>01407 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01408"></a>01408 data.line=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a01aa4796b65b1ecfd003c66f27593d8b">line</a>)); <a name="l01409"></a>01409 <span class="keywordflow">break</span>; <a name="l01410"></a>01410 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01411"></a>01411 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a000cf67c03b26e1afc7ebba2f7054649">polygon</a>)); <a name="l01412"></a>01412 <span class="keywordflow">break</span>; <a name="l01413"></a>01413 } <a name="l01414"></a>01414 }<span class="comment"></span> <a name="l01415"></a>01415 <span class="comment"> /**</span> <a name="l01416"></a>01416 <span class="comment"> * Assign a point to this object.</span> <a name="l01417"></a>01417 <span class="comment"> */</span> <a name="l01418"></a>01418 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) { <a name="l01419"></a>01419 destroy(); <a name="l01420"></a>01420 type=<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01421"></a>01421 data.point=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(p); <a name="l01422"></a>01422 }<span class="comment"></span> <a name="l01423"></a>01423 <span class="comment"> /**</span> <a name="l01424"></a>01424 <span class="comment"> * Assign a segment to this object.</span> <a name="l01425"></a>01425 <span class="comment"> */</span> <a name="l01426"></a>01426 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s) { <a name="l01427"></a>01427 destroy(); <a name="l01428"></a>01428 type=<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01429"></a>01429 data.segment=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(s); <a name="l01430"></a>01430 }<span class="comment"></span> <a name="l01431"></a>01431 <span class="comment"> /**</span> <a name="l01432"></a>01432 <span class="comment"> * Assign a line to this object.</span> <a name="l01433"></a>01433 <span class="comment"> */</span> <a name="l01434"></a>01434 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &l) { <a name="l01435"></a>01435 destroy(); <a name="l01436"></a>01436 type=<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01437"></a>01437 data.line=<span class="keyword">new</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(l); <a name="l01438"></a>01438 }<span class="comment"></span> <a name="l01439"></a>01439 <span class="comment"> /**</span> <a name="l01440"></a>01440 <span class="comment"> * Assign a polygon to this object.</span> <a name="l01441"></a>01441 <span class="comment"> */</span> <a name="l01442"></a>01442 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p) { <a name="l01443"></a>01443 destroy(); <a name="l01444"></a>01444 type=<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01445"></a>01445 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(p); <a name="l01446"></a>01446 }<span class="comment"></span> <a name="l01447"></a>01447 <span class="comment"> /**</span> <a name="l01448"></a>01448 <span class="comment"> * Project into 3D space.</span> <a name="l01449"></a>01449 <span class="comment"> */</span> <a name="l01450"></a>01450 <span class="keywordtype">void</span> generate3DObject(<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">TObject3D</a> &obj) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01451"></a>01451 <span class="comment"> /**</span> <a name="l01452"></a>01452 <span class="comment"> * Constructor from another TObject2D.</span> <a name="l01453"></a>01453 <span class="comment"> */</span> <a name="l01454"></a>01454 <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> &obj):type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) { <a name="l01455"></a>01455 operator=(obj); <a name="l01456"></a>01456 }<span class="comment"></span> <a name="l01457"></a>01457 <span class="comment"> /**</span> <a name="l01458"></a>01458 <span class="comment"> * Static method to retrieve all the points in a vector of TObject2D.</span> <a name="l01459"></a>01459 <span class="comment"> */</span> <a name="l01460"></a>01460 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &pnts);<span class="comment"></span> <a name="l01461"></a>01461 <span class="comment"> /**</span> <a name="l01462"></a>01462 <span class="comment"> * Static method to retrieve all the segments in a vector of TObject2D.</span> <a name="l01463"></a>01463 <span class="comment"> */</span> <a name="l01464"></a>01464 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TSegment2D></a> &sgms);<span class="comment"></span> <a name="l01465"></a>01465 <span class="comment"> /**</span> <a name="l01466"></a>01466 <span class="comment"> * Static method to retrieve all the lines in a vector of TObject2D.</span> <a name="l01467"></a>01467 <span class="comment"> */</span> <a name="l01468"></a>01468 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine2D></a> &lins);<span class="comment"></span> <a name="l01469"></a>01469 <span class="comment"> /**</span> <a name="l01470"></a>01470 <span class="comment"> * Static method to retrieve all the polygons in a vector of TObject2D.</span> <a name="l01471"></a>01471 <span class="comment"> */</span> <a name="l01472"></a>01472 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon2D></a> &polys);<span class="comment"></span> <a name="l01473"></a>01473 <span class="comment"> /**</span> <a name="l01474"></a>01474 <span class="comment"> * Static method to retrieve all the points in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l01475"></a>01475 <span class="comment"> */</span> <a name="l01476"></a>01476 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &pnts,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l01477"></a>01477 <span class="comment"> /**</span> <a name="l01478"></a>01478 <span class="comment"> * Static method to retrieve all the segments in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l01479"></a>01479 <span class="comment"> */</span> <a name="l01480"></a>01480 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TSegment2D></a> &sgms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l01481"></a>01481 <span class="comment"> /**</span> <a name="l01482"></a>01482 <span class="comment"> * Static method to retrieve all the lines in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l01483"></a>01483 <span class="comment"> */</span> <a name="l01484"></a>01484 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine2D></a> &lins,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l01485"></a>01485 <span class="comment"> /**</span> <a name="l01486"></a>01486 <span class="comment"> * Static method to retrieve all the polygons in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l01487"></a>01487 <span class="comment"> */</span> <a name="l01488"></a>01488 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon2D></a> &polys,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder); <a name="l01489"></a>01489 };<span class="comment"></span> <a name="l01490"></a>01490 <span class="comment"> /**</span> <a name="l01491"></a>01491 <span class="comment"> * Standard object for storing any 3D lightweight object. Do not inherit from this class.</span> <a name="l01492"></a>01492 <span class="comment"> * \sa TPoint3D,TSegment3D,TLine3D,TPlane,TPolygon3D</span> <a name="l01493"></a>01493 <span class="comment"> */</span> <a name="l01494"></a>01494 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> { <a name="l01495"></a>01495 <span class="keyword">private</span>:<span class="comment"></span> <a name="l01496"></a>01496 <span class="comment"> /**</span> <a name="l01497"></a>01497 <span class="comment"> * Object type identifier.</span> <a name="l01498"></a>01498 <span class="comment"> */</span> <a name="l01499"></a>01499 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> type;<span class="comment"></span> <a name="l01500"></a>01500 <span class="comment"> /**</span> <a name="l01501"></a>01501 <span class="comment"> * Union containing pointer to actual data.</span> <a name="l01502"></a>01502 <span class="comment"> */</span> <a name="l01503"></a>01503 <span class="keyword">union </span>{ <a name="l01504"></a>01504 TPoint3D *point; <a name="l01505"></a>01505 <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> *segment; <a name="l01506"></a>01506 <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> *line; <a name="l01507"></a>01507 <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> *polygon; <a name="l01508"></a>01508 TPlane *plane; <a name="l01509"></a>01509 } data;<span class="comment"></span> <a name="l01510"></a>01510 <span class="comment"> /**</span> <a name="l01511"></a>01511 <span class="comment"> * Destroys the object and releases the pointer, if any.</span> <a name="l01512"></a>01512 <span class="comment"> */</span> <a name="l01513"></a>01513 <span class="keywordtype">void</span> destroy() { <a name="l01514"></a>01514 <span class="keywordflow">switch</span> (type) { <a name="l01515"></a>01515 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01516"></a>01516 <span class="keyword">delete</span> data.point; <a name="l01517"></a>01517 <span class="keywordflow">break</span>; <a name="l01518"></a>01518 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01519"></a>01519 <span class="keyword">delete</span> data.segment; <a name="l01520"></a>01520 <span class="keywordflow">break</span>; <a name="l01521"></a>01521 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01522"></a>01522 <span class="keyword">delete</span> data.line; <a name="l01523"></a>01523 <span class="keywordflow">break</span>; <a name="l01524"></a>01524 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01525"></a>01525 <span class="keyword">delete</span> data.polygon; <a name="l01526"></a>01526 <span class="keywordflow">break</span>; <a name="l01527"></a>01527 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>: <a name="l01528"></a>01528 <span class="keyword">delete</span> data.plane; <a name="l01529"></a>01529 <span class="keywordflow">break</span>; <a name="l01530"></a>01530 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>: <a name="l01531"></a>01531 <span class="keywordflow">break</span>; <a name="l01532"></a>01532 <span class="keywordflow">default</span>: <a name="l01533"></a>01533 <a class="code" href="mrpt__macros_8h.html#aaa3f404ea85a6575a7139f8d101370ba">THROW_EXCEPTION</a>(<span class="stringliteral">"Invalid TObject2D object"</span>); <a name="l01534"></a>01534 } <a name="l01535"></a>01535 type=<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>; <a name="l01536"></a>01536 } <a name="l01537"></a>01537 <span class="keyword">public</span>:<span class="comment"></span> <a name="l01538"></a>01538 <span class="comment"> /**</span> <a name="l01539"></a>01539 <span class="comment"> * Constructor from point.</span> <a name="l01540"></a>01540 <span class="comment"> */</span> <a name="l01541"></a>01541 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> TPoint3D &p):type(<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>) { <a name="l01542"></a>01542 data.point=<span class="keyword">new</span> TPoint3D(p); <a name="l01543"></a>01543 }<span class="comment"></span> <a name="l01544"></a>01544 <span class="comment"> /**</span> <a name="l01545"></a>01545 <span class="comment"> * Constructor from segment.</span> <a name="l01546"></a>01546 <span class="comment"> */</span> <a name="l01547"></a>01547 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s):type(<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>) { <a name="l01548"></a>01548 data.segment=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a>(s); <a name="l01549"></a>01549 }<span class="comment"></span> <a name="l01550"></a>01550 <span class="comment"> /**</span> <a name="l01551"></a>01551 <span class="comment"> * Constructor from line.</span> <a name="l01552"></a>01552 <span class="comment"> */</span> <a name="l01553"></a>01553 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r):type(<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>) { <a name="l01554"></a>01554 data.line=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(r); <a name="l01555"></a>01555 }<span class="comment"></span> <a name="l01556"></a>01556 <span class="comment"> /**</span> <a name="l01557"></a>01557 <span class="comment"> * Constructor from polygon.</span> <a name="l01558"></a>01558 <span class="comment"> */</span> <a name="l01559"></a>01559 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) { <a name="l01560"></a>01560 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(p); <a name="l01561"></a>01561 }<span class="comment"></span> <a name="l01562"></a>01562 <span class="comment"> /**</span> <a name="l01563"></a>01563 <span class="comment"> * Constructor from plane.</span> <a name="l01564"></a>01564 <span class="comment"> */</span> <a name="l01565"></a>01565 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> TPlane &p):type(<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>) { <a name="l01566"></a>01566 data.plane=<span class="keyword">new</span> TPlane(p); <a name="l01567"></a>01567 }<span class="comment"></span> <a name="l01568"></a>01568 <span class="comment"> /**</span> <a name="l01569"></a>01569 <span class="comment"> * Empty constructor.</span> <a name="l01570"></a>01570 <span class="comment"> */</span> <a name="l01571"></a>01571 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>():type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) {}<span class="comment"></span> <a name="l01572"></a>01572 <span class="comment"> /**</span> <a name="l01573"></a>01573 <span class="comment"> * Destructor.</span> <a name="l01574"></a>01574 <span class="comment"> */</span> <a name="l01575"></a>01575 ~<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>() { <a name="l01576"></a>01576 destroy(); <a name="l01577"></a>01577 }<span class="comment"></span> <a name="l01578"></a>01578 <span class="comment"> /**</span> <a name="l01579"></a>01579 <span class="comment"> * Checks whether content is a point.</span> <a name="l01580"></a>01580 <span class="comment"> */</span> <a name="l01581"></a>01581 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isPoint()<span class="keyword"> const </span>{ <a name="l01582"></a>01582 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01583"></a>01583 }<span class="comment"></span> <a name="l01584"></a>01584 <span class="comment"> /**</span> <a name="l01585"></a>01585 <span class="comment"> * Checks whether content is a segment.</span> <a name="l01586"></a>01586 <span class="comment"> */</span> <a name="l01587"></a>01587 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isSegment()<span class="keyword"> const </span>{ <a name="l01588"></a>01588 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01589"></a>01589 }<span class="comment"></span> <a name="l01590"></a>01590 <span class="comment"> /**</span> <a name="l01591"></a>01591 <span class="comment"> * Checks whether content is a line.</span> <a name="l01592"></a>01592 <span class="comment"> */</span> <a name="l01593"></a>01593 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isLine()<span class="keyword"> const </span>{ <a name="l01594"></a>01594 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01595"></a>01595 }<span class="comment"></span> <a name="l01596"></a>01596 <span class="comment"> /**</span> <a name="l01597"></a>01597 <span class="comment"> * Checks whether content is a polygon.</span> <a name="l01598"></a>01598 <span class="comment"> */</span> <a name="l01599"></a>01599 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isPolygon()<span class="keyword"> const </span>{ <a name="l01600"></a>01600 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01601"></a>01601 }<span class="comment"></span> <a name="l01602"></a>01602 <span class="comment"> /**</span> <a name="l01603"></a>01603 <span class="comment"> * Checks whether content is a plane.</span> <a name="l01604"></a>01604 <span class="comment"> */</span> <a name="l01605"></a>01605 <span class="keyword">inline</span> <span class="keywordtype">bool</span> isPlane()<span class="keyword"> const </span>{ <a name="l01606"></a>01606 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>; <a name="l01607"></a>01607 }<span class="comment"></span> <a name="l01608"></a>01608 <span class="comment"> /**</span> <a name="l01609"></a>01609 <span class="comment"> * Gets object type.</span> <a name="l01610"></a>01610 <span class="comment"> */</span> <a name="l01611"></a>01611 <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> getType()<span class="keyword"> const </span>{ <a name="l01612"></a>01612 <span class="keywordflow">return</span> type; <a name="l01613"></a>01613 }<span class="comment"></span> <a name="l01614"></a>01614 <span class="comment"> /**</span> <a name="l01615"></a>01615 <span class="comment"> * Gets the content as a point, returning false if the type is not adequate.</span> <a name="l01616"></a>01616 <span class="comment"> */</span> <a name="l01617"></a>01617 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getPoint(TPoint3D &p)<span class="keyword"> const </span>{ <a name="l01618"></a>01618 <span class="keywordflow">if</span> (isPoint()) { <a name="l01619"></a>01619 p=*(data.point); <a name="l01620"></a>01620 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01621"></a>01621 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01622"></a>01622 }<span class="comment"></span> <a name="l01623"></a>01623 <span class="comment"> /**</span> <a name="l01624"></a>01624 <span class="comment"> * Gets the content as a segment, returning false if the type is not adequate.</span> <a name="l01625"></a>01625 <span class="comment"> */</span> <a name="l01626"></a>01626 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getSegment(<a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s)<span class="keyword"> const </span>{ <a name="l01627"></a>01627 <span class="keywordflow">if</span> (isSegment()) { <a name="l01628"></a>01628 s=*(data.segment); <a name="l01629"></a>01629 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01630"></a>01630 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01631"></a>01631 }<span class="comment"></span> <a name="l01632"></a>01632 <span class="comment"> /**</span> <a name="l01633"></a>01633 <span class="comment"> * Gets the content as a line, returning false if the type is not adequate.</span> <a name="l01634"></a>01634 <span class="comment"> */</span> <a name="l01635"></a>01635 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getLine(<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r)<span class="keyword"> const </span>{ <a name="l01636"></a>01636 <span class="keywordflow">if</span> (isLine()) { <a name="l01637"></a>01637 r=*(data.line); <a name="l01638"></a>01638 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01639"></a>01639 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01640"></a>01640 }<span class="comment"></span> <a name="l01641"></a>01641 <span class="comment"> /**</span> <a name="l01642"></a>01642 <span class="comment"> * Gets the content as a polygon, returning false if the type is not adequate.</span> <a name="l01643"></a>01643 <span class="comment"> */</span> <a name="l01644"></a>01644 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getPolygon(<a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p)<span class="keyword"> const </span>{ <a name="l01645"></a>01645 <span class="keywordflow">if</span> (isPolygon()) { <a name="l01646"></a>01646 p=*(data.polygon); <a name="l01647"></a>01647 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01648"></a>01648 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01649"></a>01649 }<span class="comment"></span> <a name="l01650"></a>01650 <span class="comment"> /**</span> <a name="l01651"></a>01651 <span class="comment"> * Gets the content as a plane, returning false if the type is not adequate.</span> <a name="l01652"></a>01652 <span class="comment"> */</span> <a name="l01653"></a>01653 <span class="keyword">inline</span> <span class="keywordtype">bool</span> getPlane(TPlane &p)<span class="keyword"> const </span>{ <a name="l01654"></a>01654 <span class="keywordflow">if</span> (isPlane()) { <a name="l01655"></a>01655 p=*(data.plane); <a name="l01656"></a>01656 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01657"></a>01657 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01658"></a>01658 }<span class="comment"></span> <a name="l01659"></a>01659 <span class="comment"> /**</span> <a name="l01660"></a>01660 <span class="comment"> * Assigns another object, creating a new pointer if needed.</span> <a name="l01661"></a>01661 <span class="comment"> */</span> <a name="l01662"></a>01662 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj) { <a name="l01663"></a>01663 <span class="keywordflow">if</span> (<span class="keyword">this</span>==&obj) <span class="keywordflow">return</span>; <a name="l01664"></a>01664 destroy(); <a name="l01665"></a>01665 <span class="keywordflow">switch</span> (type=obj.type) { <a name="l01666"></a>01666 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01667"></a>01667 data.point=<span class="keyword">new</span> TPoint3D(*(obj.data.point)); <a name="l01668"></a>01668 <span class="keywordflow">break</span>; <a name="l01669"></a>01669 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01670"></a>01670 data.segment=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a>(*(obj.data.segment)); <a name="l01671"></a>01671 <span class="keywordflow">break</span>; <a name="l01672"></a>01672 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01673"></a>01673 data.line=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(*(obj.data.line)); <a name="l01674"></a>01674 <span class="keywordflow">break</span>; <a name="l01675"></a>01675 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01676"></a>01676 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(*(obj.data.polygon)); <a name="l01677"></a>01677 <span class="keywordflow">break</span>; <a name="l01678"></a>01678 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>: <a name="l01679"></a>01679 data.plane=<span class="keyword">new</span> TPlane(*(obj.data.plane)); <a name="l01680"></a>01680 <span class="keywordflow">break</span>; <a name="l01681"></a>01681 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>: <a name="l01682"></a>01682 <span class="keywordflow">break</span>; <a name="l01683"></a>01683 <span class="keywordflow">default</span>: <a name="l01684"></a>01684 <a class="code" href="mrpt__macros_8h.html#aaa3f404ea85a6575a7139f8d101370ba">THROW_EXCEPTION</a>(<span class="stringliteral">"Invalid TObject3D object"</span>); <a name="l01685"></a>01685 } <a name="l01686"></a>01686 }<span class="comment"></span> <a name="l01687"></a>01687 <span class="comment"> /**</span> <a name="l01688"></a>01688 <span class="comment"> * Assigns a point to this object.</span> <a name="l01689"></a>01689 <span class="comment"> */</span> <a name="l01690"></a>01690 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> TPoint3D &p) { <a name="l01691"></a>01691 destroy(); <a name="l01692"></a>01692 type=<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01693"></a>01693 data.point=<span class="keyword">new</span> TPoint3D(p); <a name="l01694"></a>01694 }<span class="comment"></span> <a name="l01695"></a>01695 <span class="comment"> /**</span> <a name="l01696"></a>01696 <span class="comment"> * Assigns a segment to this object.</span> <a name="l01697"></a>01697 <span class="comment"> */</span> <a name="l01698"></a>01698 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s) { <a name="l01699"></a>01699 destroy(); <a name="l01700"></a>01700 type=<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01701"></a>01701 data.segment=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a>(s); <a name="l01702"></a>01702 }<span class="comment"></span> <a name="l01703"></a>01703 <span class="comment"> /**</span> <a name="l01704"></a>01704 <span class="comment"> * Assigns a line to this object.</span> <a name="l01705"></a>01705 <span class="comment"> */</span> <a name="l01706"></a>01706 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &l) { <a name="l01707"></a>01707 destroy(); <a name="l01708"></a>01708 type=<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01709"></a>01709 data.line=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>(l); <a name="l01710"></a>01710 }<span class="comment"></span> <a name="l01711"></a>01711 <span class="comment"> /**</span> <a name="l01712"></a>01712 <span class="comment"> * Assigns a polygon to this object.</span> <a name="l01713"></a>01713 <span class="comment"> */</span> <a name="l01714"></a>01714 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p) { <a name="l01715"></a>01715 destroy(); <a name="l01716"></a>01716 type=<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01717"></a>01717 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(p); <a name="l01718"></a>01718 }<span class="comment"></span> <a name="l01719"></a>01719 <span class="comment"> /**</span> <a name="l01720"></a>01720 <span class="comment"> * Assigns a plane to this object.</span> <a name="l01721"></a>01721 <span class="comment"> */</span> <a name="l01722"></a>01722 <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> TPlane &p) { <a name="l01723"></a>01723 destroy(); <a name="l01724"></a>01724 type=<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>; <a name="l01725"></a>01725 data.plane=<span class="keyword">new</span> TPlane(p); <a name="l01726"></a>01726 }<span class="comment"></span> <a name="l01727"></a>01727 <span class="comment"> /**</span> <a name="l01728"></a>01728 <span class="comment"> * Projects into 2D space.</span> <a name="l01729"></a>01729 <span class="comment"> * \throw std::logic_error if the 3D object loses its properties when projecting into 2D space (for example, it's a plane or a vertical line).</span> <a name="l01730"></a>01730 <span class="comment"> */</span> <a name="l01731"></a>01731 <span class="keyword">inline</span> <span class="keywordtype">void</span> generate2DObject(TObject2D &obj)<span class="keyword"> const </span>{ <a name="l01732"></a>01732 <span class="keywordflow">switch</span> (type) { <a name="l01733"></a>01733 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01734"></a>01734 obj=TPoint2D(*(data.point)); <a name="l01735"></a>01735 <span class="keywordflow">break</span>; <a name="l01736"></a>01736 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01737"></a>01737 obj=TSegment2D(*(data.segment)); <a name="l01738"></a>01738 <span class="keywordflow">break</span>; <a name="l01739"></a>01739 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01740"></a>01740 obj=TLine2D(*(data.line)); <a name="l01741"></a>01741 <span class="keywordflow">break</span>; <a name="l01742"></a>01742 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01743"></a>01743 obj=TPolygon2D(*(data.polygon)); <a name="l01744"></a>01744 <span class="keywordflow">break</span>; <a name="l01745"></a>01745 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>: <a name="l01746"></a>01746 <span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Too many dimensions"</span>); <a name="l01747"></a>01747 <span class="keywordflow">default</span>: <a name="l01748"></a>01748 obj=TObject2D(); <a name="l01749"></a>01749 <span class="keywordflow">break</span>; <a name="l01750"></a>01750 } <a name="l01751"></a>01751 }<span class="comment"></span> <a name="l01752"></a>01752 <span class="comment"> /**</span> <a name="l01753"></a>01753 <span class="comment"> * Constructs from another object.</span> <a name="l01754"></a>01754 <span class="comment"> */</span> <a name="l01755"></a>01755 <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj):type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) { <a name="l01756"></a>01756 operator=(obj); <a name="l01757"></a>01757 }<span class="comment"></span> <a name="l01758"></a>01758 <span class="comment"> /**</span> <a name="l01759"></a>01759 <span class="comment"> * Static method to retrieve every point included in a vector of objects.</span> <a name="l01760"></a>01760 <span class="comment"> */</span> <a name="l01761"></a>01761 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &pnts);<span class="comment"></span> <a name="l01762"></a>01762 <span class="comment"> /**</span> <a name="l01763"></a>01763 <span class="comment"> * Static method to retrieve every segment included in a vector of objects.</span> <a name="l01764"></a>01764 <span class="comment"> */</span> <a name="l01765"></a>01765 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &sgms);<span class="comment"></span> <a name="l01766"></a>01766 <span class="comment"> /**</span> <a name="l01767"></a>01767 <span class="comment"> * Static method to retrieve every line included in a vector of objects.</span> <a name="l01768"></a>01768 <span class="comment"> */</span> <a name="l01769"></a>01769 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine3D></a> &lins);<span class="comment"></span> <a name="l01770"></a>01770 <span class="comment"> /**</span> <a name="l01771"></a>01771 <span class="comment"> * Static method to retrieve every plane included in a vector of objects.</span> <a name="l01772"></a>01772 <span class="comment"> */</span> <a name="l01773"></a>01773 <span class="keyword">static</span> <span class="keywordtype">void</span> getPlanes(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPlane></a> &plns);<span class="comment"></span> <a name="l01774"></a>01774 <span class="comment"> /**</span> <a name="l01775"></a>01775 <span class="comment"> * Static method to retrieve every polygon included in a vector of objects.</span> <a name="l01776"></a>01776 <span class="comment"> */</span> <a name="l01777"></a>01777 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys);<span class="comment"></span> <a name="l01778"></a>01778 <span class="comment"> /**</span> <a name="l01779"></a>01779 <span class="comment"> * Static method to retrieve every point included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l01780"></a>01780 <span class="comment"> */</span> <a name="l01781"></a>01781 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &pnts,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l01782"></a>01782 <span class="comment"> /**</span> <a name="l01783"></a>01783 <span class="comment"> * Static method to retrieve every segment included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l01784"></a>01784 <span class="comment"> */</span> <a name="l01785"></a>01785 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &sgms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l01786"></a>01786 <span class="comment"> /**</span> <a name="l01787"></a>01787 <span class="comment"> * Static method to retrieve every line included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l01788"></a>01788 <span class="comment"> */</span> <a name="l01789"></a>01789 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine3D></a> &lins,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l01790"></a>01790 <span class="comment"> /**</span> <a name="l01791"></a>01791 <span class="comment"> * Static method to retrieve every plane included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l01792"></a>01792 <span class="comment"> */</span> <a name="l01793"></a>01793 <span class="keyword">static</span> <span class="keywordtype">void</span> getPlanes(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPlane></a> &plns,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l01794"></a>01794 <span class="comment"> /**</span> <a name="l01795"></a>01795 <span class="comment"> * Static method to retrieve every polygon included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l01796"></a>01796 <span class="comment"> */</span> <a name="l01797"></a>01797 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder); <a name="l01798"></a>01798 }; <a name="l01799"></a>01799 <span class="preprocessor">#else</span> <a name="l01800"></a>01800 <span class="preprocessor"></span> <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TObject2D { <a name="l01801"></a>01801 <span class="keyword">private</span>:<span class="comment"></span> <a name="l01802"></a>01802 <span class="comment"> /**</span> <a name="l01803"></a>01803 <span class="comment"> * Object type identifier.</span> <a name="l01804"></a>01804 <span class="comment"> */</span> <a name="l01805"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7655cd0519a403e4e4c2393debd6b0da">01805</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7655cd0519a403e4e4c2393debd6b0da" title="Object type identifier.">type</a>;<span class="comment"></span> <a name="l01806"></a>01806 <span class="comment"> /**</span> <a name="l01807"></a>01807 <span class="comment"> * Union type storing pointers to every allowed type.</span> <a name="l01808"></a>01808 <span class="comment"> */</span> <a name="l01809"></a>01809 <span class="keyword">struct </span>{ <a name="l01810"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a639f8f371a97ffba68507854f5bc38e3">01810</a> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a639f8f371a97ffba68507854f5bc38e3">point</a>; <a name="l01811"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1bb4e6be37d0ded92003a8354afde2f7">01811</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1bb4e6be37d0ded92003a8354afde2f7">segment</a>; <a name="l01812"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a01aa4796b65b1ecfd003c66f27593d8b">01812</a> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a01aa4796b65b1ecfd003c66f27593d8b">line</a>; <a name="l01813"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a000cf67c03b26e1afc7ebba2f7054649">01813</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> *<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a000cf67c03b26e1afc7ebba2f7054649">polygon</a>; <a name="l01814"></a>01814 } data;<span class="comment"></span> <a name="l01815"></a>01815 <span class="comment"> /**</span> <a name="l01816"></a>01816 <span class="comment"> * Destroys the object, releasing the pointer to the content (if any).</span> <a name="l01817"></a>01817 <span class="comment"> */</span> <a name="l01818"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aadfa7a72d6ac7dc6b595db651bbba88e">01818</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aadfa7a72d6ac7dc6b595db651bbba88e" title="Destroys the object, releasing the pointer to the content (if any).">destroy</a>() { <a name="l01819"></a>01819 <span class="keywordflow">if</span> (type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) <span class="keyword">delete</span> data.polygon; <a name="l01820"></a>01820 type=<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>; <a name="l01821"></a>01821 } <a name="l01822"></a>01822 <span class="keyword">public</span>:<span class="comment"></span> <a name="l01823"></a>01823 <span class="comment"> /**</span> <a name="l01824"></a>01824 <span class="comment"> * Implicit constructor from point.</span> <a name="l01825"></a>01825 <span class="comment"> */</span> <a name="l01826"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a4e58c6783dec7d8c576d33c8d2df025f">01826</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a4e58c6783dec7d8c576d33c8d2df025f" title="Implicit constructor from point.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>) { <a name="l01827"></a>01827 data.point=p; <a name="l01828"></a>01828 }<span class="comment"></span> <a name="l01829"></a>01829 <span class="comment"> /**</span> <a name="l01830"></a>01830 <span class="comment"> * Implicit constructor from segment.</span> <a name="l01831"></a>01831 <span class="comment"> */</span> <a name="l01832"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aca2c3c6cb60b90a9c120d469a68a1fb7">01832</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aca2c3c6cb60b90a9c120d469a68a1fb7" title="Implicit constructor from segment.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s):type(<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>) { <a name="l01833"></a>01833 data.segment=s; <a name="l01834"></a>01834 }<span class="comment"></span> <a name="l01835"></a>01835 <span class="comment"> /**</span> <a name="l01836"></a>01836 <span class="comment"> * Implicit constructor from line.</span> <a name="l01837"></a>01837 <span class="comment"> */</span> <a name="l01838"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7cf6423dd1ab1a56c52ce591376a6d31">01838</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7cf6423dd1ab1a56c52ce591376a6d31" title="Implicit constructor from line.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &r):type(<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>) { <a name="l01839"></a>01839 data.line=r; <a name="l01840"></a>01840 }<span class="comment"></span> <a name="l01841"></a>01841 <span class="comment"> /**</span> <a name="l01842"></a>01842 <span class="comment"> * Implicit constructor from polygon.</span> <a name="l01843"></a>01843 <span class="comment"> */</span> <a name="l01844"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac83c29cac983807f30f92ccec5d3b507">01844</a> <span class="keyword">inline</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac83c29cac983807f30f92ccec5d3b507" title="Implicit constructor from polygon.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) { <a name="l01845"></a>01845 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(p); <a name="l01846"></a>01846 }<span class="comment"></span> <a name="l01847"></a>01847 <span class="comment"> /**</span> <a name="l01848"></a>01848 <span class="comment"> * Implicit constructor from polygon.</span> <a name="l01849"></a>01849 <span class="comment"> */</span> <a name="l01850"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ae7a8916fe1e7425d115d103ce240daa7">01850</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ae7a8916fe1e7425d115d103ce240daa7" title="Implicit constructor from polygon.">TObject2D</a>():type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) {}<span class="comment"></span> <a name="l01851"></a>01851 <span class="comment"> /**</span> <a name="l01852"></a>01852 <span class="comment"> * Object destruction.</span> <a name="l01853"></a>01853 <span class="comment"> */</span> <a name="l01854"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a714861f7d71e5d8d0721c01e93a1d3bd">01854</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a714861f7d71e5d8d0721c01e93a1d3bd" title="Object destruction.">~TObject2D</a>() { <a name="l01855"></a>01855 destroy(); <a name="l01856"></a>01856 }<span class="comment"></span> <a name="l01857"></a>01857 <span class="comment"> /**</span> <a name="l01858"></a>01858 <span class="comment"> * Checks whether content is a point.</span> <a name="l01859"></a>01859 <span class="comment"> */</span> <a name="l01860"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aa2aa7cb77c3c6f740836db18dc42cd97">01860</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aa2aa7cb77c3c6f740836db18dc42cd97" title="Checks whether content is a point.">isPoint</a>()<span class="keyword"> const </span>{ <a name="l01861"></a>01861 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01862"></a>01862 }<span class="comment"></span> <a name="l01863"></a>01863 <span class="comment"> /**</span> <a name="l01864"></a>01864 <span class="comment"> * Checks whether content is a segment.</span> <a name="l01865"></a>01865 <span class="comment"> */</span> <a name="l01866"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#af26c88885f1fae595ce4015eb4d5755f">01866</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#af26c88885f1fae595ce4015eb4d5755f" title="Checks whether content is a segment.">isSegment</a>()<span class="keyword"> const </span>{ <a name="l01867"></a>01867 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01868"></a>01868 }<span class="comment"></span> <a name="l01869"></a>01869 <span class="comment"> /**</span> <a name="l01870"></a>01870 <span class="comment"> * Checks whether content is a line.</span> <a name="l01871"></a>01871 <span class="comment"> */</span> <a name="l01872"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a48afd1998c42d25f641b6d5b74f3a2fe">01872</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a48afd1998c42d25f641b6d5b74f3a2fe" title="Checks whether content is a line.">isLine</a>()<span class="keyword"> const </span>{ <a name="l01873"></a>01873 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01874"></a>01874 }<span class="comment"></span> <a name="l01875"></a>01875 <span class="comment"> /**</span> <a name="l01876"></a>01876 <span class="comment"> * Checks whether content is a polygon.</span> <a name="l01877"></a>01877 <span class="comment"> */</span> <a name="l01878"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aa26e3d709163eb4b976bd8926f6e3858">01878</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aa26e3d709163eb4b976bd8926f6e3858" title="Checks whether content is a polygon.">isPolygon</a>()<span class="keyword"> const </span>{ <a name="l01879"></a>01879 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01880"></a>01880 }<span class="comment"></span> <a name="l01881"></a>01881 <span class="comment"> /**</span> <a name="l01882"></a>01882 <span class="comment"> * Gets content type.</span> <a name="l01883"></a>01883 <span class="comment"> */</span> <a name="l01884"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aee224b1b599dca87189399def8c07da2">01884</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aee224b1b599dca87189399def8c07da2" title="Gets content type.">getType</a>()<span class="keyword"> const </span>{ <a name="l01885"></a>01885 <span class="keywordflow">return</span> type; <a name="l01886"></a>01886 }<span class="comment"></span> <a name="l01887"></a>01887 <span class="comment"> /**</span> <a name="l01888"></a>01888 <span class="comment"> * Gets the content as a point, returning false if the type is inadequate.</span> <a name="l01889"></a>01889 <span class="comment"> */</span> <a name="l01890"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac0efac6ec7de378d55f5ce6e64f80ac2">01890</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac0efac6ec7de378d55f5ce6e64f80ac2" title="Gets the content as a point, returning false if the type is inadequate.">getPoint</a>(<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p)<span class="keyword"> const </span>{ <a name="l01891"></a>01891 <span class="keywordflow">if</span> (isPoint()) { <a name="l01892"></a>01892 p=data.point; <a name="l01893"></a>01893 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01894"></a>01894 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01895"></a>01895 }<span class="comment"></span> <a name="l01896"></a>01896 <span class="comment"> /**</span> <a name="l01897"></a>01897 <span class="comment"> * Gets the content as a segment, returning false if the type is inadequate.</span> <a name="l01898"></a>01898 <span class="comment"> */</span> <a name="l01899"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a6750b0792af014b2b5daea3f8cc5c746">01899</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a6750b0792af014b2b5daea3f8cc5c746" title="Gets the content as a segment, returning false if the type is inadequate.">getSegment</a>(<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s)<span class="keyword"> const </span>{ <a name="l01900"></a>01900 <span class="keywordflow">if</span> (isSegment()) { <a name="l01901"></a>01901 s=data.segment; <a name="l01902"></a>01902 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01903"></a>01903 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01904"></a>01904 }<span class="comment"></span> <a name="l01905"></a>01905 <span class="comment"> /**</span> <a name="l01906"></a>01906 <span class="comment"> * Gets the content as a line, returning false if the type is inadequate.</span> <a name="l01907"></a>01907 <span class="comment"> */</span> <a name="l01908"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#adfd4f1fc23d73b917fd66bae2045683a">01908</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#adfd4f1fc23d73b917fd66bae2045683a" title="Gets the content as a line, returning false if the type is inadequate.">getLine</a>(<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &r)<span class="keyword"> const </span>{ <a name="l01909"></a>01909 <span class="keywordflow">if</span> (isLine()) { <a name="l01910"></a>01910 r=data.line; <a name="l01911"></a>01911 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01912"></a>01912 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01913"></a>01913 }<span class="comment"></span> <a name="l01914"></a>01914 <span class="comment"> /**</span> <a name="l01915"></a>01915 <span class="comment"> * Gets the content as a polygon, returning false if the type is inadequate.</span> <a name="l01916"></a>01916 <span class="comment"> */</span> <a name="l01917"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1e454dbbfd9186a35b7cefb79c02c331">01917</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1e454dbbfd9186a35b7cefb79c02c331" title="Gets the content as a polygon, returning false if the type is inadequate.">getPolygon</a>(<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p)<span class="keyword"> const </span>{ <a name="l01918"></a>01918 <span class="keywordflow">if</span> (isPolygon()) { <a name="l01919"></a>01919 p=*(data.polygon); <a name="l01920"></a>01920 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01921"></a>01921 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01922"></a>01922 }<span class="comment"></span> <a name="l01923"></a>01923 <span class="comment"> /**</span> <a name="l01924"></a>01924 <span class="comment"> * Assign another TObject2D. Pointers are not shared.</span> <a name="l01925"></a>01925 <span class="comment"> */</span> <a name="l01926"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac024397d6d6c04156783219926bdca0b">01926</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ac024397d6d6c04156783219926bdca0b" title="Assign another TObject2D.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> &obj) { <a name="l01927"></a>01927 <span class="keywordflow">if</span> (<span class="keyword">this</span>==&obj) <span class="keywordflow">return</span>; <a name="l01928"></a>01928 destroy(); <a name="l01929"></a>01929 <span class="keywordflow">switch</span> (type=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7655cd0519a403e4e4c2393debd6b0da" title="Object type identifier.">type</a>) { <a name="l01930"></a>01930 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l01931"></a>01931 data.point=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a639f8f371a97ffba68507854f5bc38e3">point</a>; <a name="l01932"></a>01932 <span class="keywordflow">break</span>; <a name="l01933"></a>01933 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l01934"></a>01934 data.segment=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1bb4e6be37d0ded92003a8354afde2f7">segment</a>; <a name="l01935"></a>01935 <span class="keywordflow">break</span>; <a name="l01936"></a>01936 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l01937"></a>01937 data.line=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a01aa4796b65b1ecfd003c66f27593d8b">line</a>; <a name="l01938"></a>01938 <span class="keywordflow">break</span>; <a name="l01939"></a>01939 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l01940"></a>01940 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a7df4c287c09bd892e9e446386d9d43ed" title="Union type storing pointers to every allowed type.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a000cf67c03b26e1afc7ebba2f7054649">polygon</a>)); <a name="l01941"></a>01941 <span class="keywordflow">break</span>; <a name="l01942"></a>01942 } <a name="l01943"></a>01943 }<span class="comment"></span> <a name="l01944"></a>01944 <span class="comment"> /**</span> <a name="l01945"></a>01945 <span class="comment"> * Assign a point to this object.</span> <a name="l01946"></a>01946 <span class="comment"> */</span> <a name="l01947"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1d638d92e0cb1f1fa7c4c52126ee93bb">01947</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a1d638d92e0cb1f1fa7c4c52126ee93bb" title="Assign a point to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &p) { <a name="l01948"></a>01948 destroy(); <a name="l01949"></a>01949 type=<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l01950"></a>01950 data.point=p; <a name="l01951"></a>01951 }<span class="comment"></span> <a name="l01952"></a>01952 <span class="comment"> /**</span> <a name="l01953"></a>01953 <span class="comment"> * Assign a segment to this object.</span> <a name="l01954"></a>01954 <span class="comment"> */</span> <a name="l01955"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ad74f6e87657cc65a7de6c7be2c8d03b8">01955</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#ad74f6e87657cc65a7de6c7be2c8d03b8" title="Assign a segment to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s) { <a name="l01956"></a>01956 destroy(); <a name="l01957"></a>01957 type=<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l01958"></a>01958 data.segment=s; <a name="l01959"></a>01959 }<span class="comment"></span> <a name="l01960"></a>01960 <span class="comment"> /**</span> <a name="l01961"></a>01961 <span class="comment"> * Assign a line to this object.</span> <a name="l01962"></a>01962 <span class="comment"> */</span> <a name="l01963"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aae97b9b79f64f76d176211e7f7e79980">01963</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#aae97b9b79f64f76d176211e7f7e79980" title="Assign a line to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &l) { <a name="l01964"></a>01964 destroy(); <a name="l01965"></a>01965 type=<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l01966"></a>01966 data.line=l; <a name="l01967"></a>01967 }<span class="comment"></span> <a name="l01968"></a>01968 <span class="comment"> /**</span> <a name="l01969"></a>01969 <span class="comment"> * Assign a polygon to this object.</span> <a name="l01970"></a>01970 <span class="comment"> */</span> <a name="l01971"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a8cb2a1c4df7160457eb02f09aba0e062">01971</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a8cb2a1c4df7160457eb02f09aba0e062" title="Assign a polygon to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p) { <a name="l01972"></a>01972 destroy(); <a name="l01973"></a>01973 type=<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l01974"></a>01974 data.polygon=<span class="keyword">new</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(p); <a name="l01975"></a>01975 }<span class="comment"></span> <a name="l01976"></a>01976 <span class="comment"> /**</span> <a name="l01977"></a>01977 <span class="comment"> * Project into 3D space.</span> <a name="l01978"></a>01978 <span class="comment"> */</span> <a name="l01979"></a>01979 <span class="keywordtype">void</span> generate3DObject(<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">TObject3D</a> &obj) <span class="keyword">const</span>;<span class="comment"></span> <a name="l01980"></a>01980 <span class="comment"> /**</span> <a name="l01981"></a>01981 <span class="comment"> * Constructor from another TObject2D.</span> <a name="l01982"></a>01982 <span class="comment"> */</span> <a name="l01983"></a><a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a8c919a643641ed794172f2ed64c56570">01983</a> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html#a8c919a643641ed794172f2ed64c56570" title="Constructor from another TObject2D.">TObject2D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> &obj):type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) { <a name="l01984"></a>01984 operator=(obj); <a name="l01985"></a>01985 }<span class="comment"></span> <a name="l01986"></a>01986 <span class="comment"> /**</span> <a name="l01987"></a>01987 <span class="comment"> * Static method to retrieve all the points in a vector of TObject2D.</span> <a name="l01988"></a>01988 <span class="comment"> */</span> <a name="l01989"></a>01989 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &pnts);<span class="comment"></span> <a name="l01990"></a>01990 <span class="comment"> /**</span> <a name="l01991"></a>01991 <span class="comment"> * Static method to retrieve all the segments in a vector of TObject2D.</span> <a name="l01992"></a>01992 <span class="comment"> */</span> <a name="l01993"></a>01993 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TSegment2D></a> &sgms);<span class="comment"></span> <a name="l01994"></a>01994 <span class="comment"> /**</span> <a name="l01995"></a>01995 <span class="comment"> * Static method to retrieve all the lines in a vector of TObject2D.</span> <a name="l01996"></a>01996 <span class="comment"> */</span> <a name="l01997"></a>01997 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine2D></a> &lins);<span class="comment"></span> <a name="l01998"></a>01998 <span class="comment"> /**</span> <a name="l01999"></a>01999 <span class="comment"> * Static method to retrieve all the polygons in a vector of TObject2D.</span> <a name="l02000"></a>02000 <span class="comment"> */</span> <a name="l02001"></a>02001 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon2D></a> &polys);<span class="comment"></span> <a name="l02002"></a>02002 <span class="comment"> /**</span> <a name="l02003"></a>02003 <span class="comment"> * Static method to retrieve all the points in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l02004"></a>02004 <span class="comment"> */</span> <a name="l02005"></a>02005 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &pnts,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l02006"></a>02006 <span class="comment"> /**</span> <a name="l02007"></a>02007 <span class="comment"> * Static method to retrieve all the segments in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l02008"></a>02008 <span class="comment"> */</span> <a name="l02009"></a>02009 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TSegment2D></a> &sgms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l02010"></a>02010 <span class="comment"> /**</span> <a name="l02011"></a>02011 <span class="comment"> * Static method to retrieve all the lines in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l02012"></a>02012 <span class="comment"> */</span> <a name="l02013"></a>02013 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine2D></a> &lins,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder);<span class="comment"></span> <a name="l02014"></a>02014 <span class="comment"> /**</span> <a name="l02015"></a>02015 <span class="comment"> * Static method to retrieve all the polygons in a vector of TObject2D, returning the remainder objects in another parameter.</span> <a name="l02016"></a>02016 <span class="comment"> */</span> <a name="l02017"></a>02017 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon2D></a> &polys,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject2D></a> &remainder); <a name="l02018"></a>02018 };<span class="comment"></span> <a name="l02019"></a>02019 <span class="comment"> /**</span> <a name="l02020"></a>02020 <span class="comment"> * Standard object for storing any 3D lightweight object. Do not inherit from this class.</span> <a name="l02021"></a>02021 <span class="comment"> * \sa TPoint3D,TSegment3D,TLine3D,TPlane,TPolygon3D</span> <a name="l02022"></a>02022 <span class="comment"> */</span> <a name="l02023"></a>02023 <span class="keyword">struct </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> { <a name="l02024"></a>02024 <span class="keyword">private</span>:<span class="comment"></span> <a name="l02025"></a>02025 <span class="comment"> /**</span> <a name="l02026"></a>02026 <span class="comment"> * Object type identifier.</span> <a name="l02027"></a>02027 <span class="comment"> */</span> <a name="l02028"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#acc2d1bbbae29e99b1e10b0a1f21e2f94">02028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#acc2d1bbbae29e99b1e10b0a1f21e2f94" title="Object type identifier.">type</a>;<span class="comment"></span> <a name="l02029"></a>02029 <span class="comment"> /**</span> <a name="l02030"></a>02030 <span class="comment"> * Union containing pointer to actual data.</span> <a name="l02031"></a>02031 <span class="comment"> */</span> <a name="l02032"></a>02032 <span class="keyword">struct </span>{ <a name="l02033"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a9bf83bb6456777826a7f27dd1ec3b0e7">02033</a> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a9bf83bb6456777826a7f27dd1ec3b0e7">point</a>; <a name="l02034"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aae896b7288413bf7ecc66d9912433f18">02034</a> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aae896b7288413bf7ecc66d9912433f18">segment</a>; <a name="l02035"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a34fa68120ef7d84fea9c0f9b9cd27c62">02035</a> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a34fa68120ef7d84fea9c0f9b9cd27c62">line</a>; <a name="l02036"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad21f939efa13a8a24cde2257a4c88eac">02036</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> *<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad21f939efa13a8a24cde2257a4c88eac">polygon</a>; <a name="l02037"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a3878492604c5d553e0dfbfd20c5e0c2e">02037</a> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a3878492604c5d553e0dfbfd20c5e0c2e">plane</a>; <a name="l02038"></a>02038 } data;<span class="comment"></span> <a name="l02039"></a>02039 <span class="comment"> /**</span> <a name="l02040"></a>02040 <span class="comment"> * Destroys the object and releases the pointer, if any.</span> <a name="l02041"></a>02041 <span class="comment"> */</span> <a name="l02042"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a44ac1fa68bb7c6c7ca9677d5c69d49fe">02042</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a44ac1fa68bb7c6c7ca9677d5c69d49fe" title="Destroys the object and releases the pointer, if any.">destroy</a>() { <a name="l02043"></a>02043 <span class="keywordflow">if</span> (type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) <span class="keyword">delete</span> data.polygon; <a name="l02044"></a>02044 type=<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>; <a name="l02045"></a>02045 } <a name="l02046"></a>02046 <span class="keyword">public</span>:<span class="comment"></span> <a name="l02047"></a>02047 <span class="comment"> /**</span> <a name="l02048"></a>02048 <span class="comment"> * Constructor from point.</span> <a name="l02049"></a>02049 <span class="comment"> */</span> <a name="l02050"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a970f3cd26dd4778af7cfc4392a08c163">02050</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a970f3cd26dd4778af7cfc4392a08c163" title="Constructor from point.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>) { <a name="l02051"></a>02051 data.point=p; <a name="l02052"></a>02052 }<span class="comment"></span> <a name="l02053"></a>02053 <span class="comment"> /**</span> <a name="l02054"></a>02054 <span class="comment"> * Constructor from segment.</span> <a name="l02055"></a>02055 <span class="comment"> */</span> <a name="l02056"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ababb460d5216bf36ac8862b0f87884fe">02056</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ababb460d5216bf36ac8862b0f87884fe" title="Constructor from segment.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s):type(<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>) { <a name="l02057"></a>02057 data.segment=s; <a name="l02058"></a>02058 }<span class="comment"></span> <a name="l02059"></a>02059 <span class="comment"> /**</span> <a name="l02060"></a>02060 <span class="comment"> * Constructor from line.</span> <a name="l02061"></a>02061 <span class="comment"> */</span> <a name="l02062"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a43ce1399e8d1bfa6a49f479d11a52d9e">02062</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a43ce1399e8d1bfa6a49f479d11a52d9e" title="Constructor from line.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &r):type(<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>) { <a name="l02063"></a>02063 data.line=r; <a name="l02064"></a>02064 }<span class="comment"></span> <a name="l02065"></a>02065 <span class="comment"> /**</span> <a name="l02066"></a>02066 <span class="comment"> * Constructor from polygon.</span> <a name="l02067"></a>02067 <span class="comment"> */</span> <a name="l02068"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad91b1c2b72953222ebc9a057cd84a57f">02068</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad91b1c2b72953222ebc9a057cd84a57f" title="Constructor from polygon.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p):type(<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>) { <a name="l02069"></a>02069 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(p); <a name="l02070"></a>02070 }<span class="comment"></span> <a name="l02071"></a>02071 <span class="comment"> /**</span> <a name="l02072"></a>02072 <span class="comment"> * Constructor from plane.</span> <a name="l02073"></a>02073 <span class="comment"> */</span> <a name="l02074"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a5bff987c33c6a6603b6e827bc04f5d5a">02074</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a5bff987c33c6a6603b6e827bc04f5d5a" title="Constructor from plane.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &p):type(<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>) { <a name="l02075"></a>02075 data.plane=p; <a name="l02076"></a>02076 }<span class="comment"></span> <a name="l02077"></a>02077 <span class="comment"> /**</span> <a name="l02078"></a>02078 <span class="comment"> * Empty constructor.</span> <a name="l02079"></a>02079 <span class="comment"> */</span> <a name="l02080"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ade3053140c7bbd225835449061a49e71">02080</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ade3053140c7bbd225835449061a49e71" title="Empty constructor.">TObject3D</a>():type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) {}<span class="comment"></span> <a name="l02081"></a>02081 <span class="comment"> /**</span> <a name="l02082"></a>02082 <span class="comment"> * Destructor.</span> <a name="l02083"></a>02083 <span class="comment"> */</span> <a name="l02084"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a6905725c2560caed5c6e4e7ff876046e">02084</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a6905725c2560caed5c6e4e7ff876046e" title="Destructor.">~TObject3D</a>() { <a name="l02085"></a>02085 destroy(); <a name="l02086"></a>02086 }<span class="comment"></span> <a name="l02087"></a>02087 <span class="comment"> /**</span> <a name="l02088"></a>02088 <span class="comment"> * Checks whether content is a point.</span> <a name="l02089"></a>02089 <span class="comment"> */</span> <a name="l02090"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad462e547cc7b5db8b99c7a2b852bee5a">02090</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad462e547cc7b5db8b99c7a2b852bee5a" title="Checks whether content is a point.">isPoint</a>()<span class="keyword"> const </span>{ <a name="l02091"></a>02091 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l02092"></a>02092 }<span class="comment"></span> <a name="l02093"></a>02093 <span class="comment"> /**</span> <a name="l02094"></a>02094 <span class="comment"> * Checks whether content is a segment.</span> <a name="l02095"></a>02095 <span class="comment"> */</span> <a name="l02096"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a38a7b74f1c2e7161b1a068710c079081">02096</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a38a7b74f1c2e7161b1a068710c079081" title="Checks whether content is a segment.">isSegment</a>()<span class="keyword"> const </span>{ <a name="l02097"></a>02097 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l02098"></a>02098 }<span class="comment"></span> <a name="l02099"></a>02099 <span class="comment"> /**</span> <a name="l02100"></a>02100 <span class="comment"> * Checks whether content is a line.</span> <a name="l02101"></a>02101 <span class="comment"> */</span> <a name="l02102"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a85ade6c622e50311e7580448d2718add">02102</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a85ade6c622e50311e7580448d2718add" title="Checks whether content is a line.">isLine</a>()<span class="keyword"> const </span>{ <a name="l02103"></a>02103 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l02104"></a>02104 }<span class="comment"></span> <a name="l02105"></a>02105 <span class="comment"> /**</span> <a name="l02106"></a>02106 <span class="comment"> * Checks whether content is a polygon.</span> <a name="l02107"></a>02107 <span class="comment"> */</span> <a name="l02108"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a644c7174c84be0bde895dd75182cb8cc">02108</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a644c7174c84be0bde895dd75182cb8cc" title="Checks whether content is a polygon.">isPolygon</a>()<span class="keyword"> const </span>{ <a name="l02109"></a>02109 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l02110"></a>02110 }<span class="comment"></span> <a name="l02111"></a>02111 <span class="comment"> /**</span> <a name="l02112"></a>02112 <span class="comment"> * Checks whether content is a plane.</span> <a name="l02113"></a>02113 <span class="comment"> */</span> <a name="l02114"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a24f2b004d93fd33c6c32da82f8b98bd0">02114</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a24f2b004d93fd33c6c32da82f8b98bd0" title="Checks whether content is a plane.">isPlane</a>()<span class="keyword"> const </span>{ <a name="l02115"></a>02115 <span class="keywordflow">return</span> type==<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>; <a name="l02116"></a>02116 }<span class="comment"></span> <a name="l02117"></a>02117 <span class="comment"> /**</span> <a name="l02118"></a>02118 <span class="comment"> * Gets object type.</span> <a name="l02119"></a>02119 <span class="comment"> */</span> <a name="l02120"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aa3844494f4d8617a5ac5120b9a2761ac">02120</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aa3844494f4d8617a5ac5120b9a2761ac" title="Gets object type.">getType</a>()<span class="keyword"> const </span>{ <a name="l02121"></a>02121 <span class="keywordflow">return</span> type; <a name="l02122"></a>02122 }<span class="comment"></span> <a name="l02123"></a>02123 <span class="comment"> /**</span> <a name="l02124"></a>02124 <span class="comment"> * Gets the content as a point, returning false if the type is not adequate.</span> <a name="l02125"></a>02125 <span class="comment"> */</span> <a name="l02126"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a4f786f709cb55a0f2d2e75db532c9429">02126</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a4f786f709cb55a0f2d2e75db532c9429" title="Gets the content as a point, returning false if the type is not adequate.">getPoint</a>(<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p)<span class="keyword"> const </span>{ <a name="l02127"></a>02127 <span class="keywordflow">if</span> (isPoint()) { <a name="l02128"></a>02128 p=data.point; <a name="l02129"></a>02129 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02130"></a>02130 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02131"></a>02131 }<span class="comment"></span> <a name="l02132"></a>02132 <span class="comment"> /**</span> <a name="l02133"></a>02133 <span class="comment"> * Gets the content as a segment, returning false if the type is not adequate.</span> <a name="l02134"></a>02134 <span class="comment"> */</span> <a name="l02135"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#acdff874c03ff29e10ea2f4638513f748">02135</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#acdff874c03ff29e10ea2f4638513f748" title="Gets the content as a segment, returning false if the type is not adequate.">getSegment</a>(<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s)<span class="keyword"> const </span>{ <a name="l02136"></a>02136 <span class="keywordflow">if</span> (isSegment()) { <a name="l02137"></a>02137 s=data.segment; <a name="l02138"></a>02138 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02139"></a>02139 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02140"></a>02140 }<span class="comment"></span> <a name="l02141"></a>02141 <span class="comment"> /**</span> <a name="l02142"></a>02142 <span class="comment"> * Gets the content as a line, returning false if the type is not adequate.</span> <a name="l02143"></a>02143 <span class="comment"> */</span> <a name="l02144"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a9dcbf0e2c9be05e0077146e3ae46b75c">02144</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a9dcbf0e2c9be05e0077146e3ae46b75c" title="Gets the content as a line, returning false if the type is not adequate.">getLine</a>(<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &r)<span class="keyword"> const </span>{ <a name="l02145"></a>02145 <span class="keywordflow">if</span> (isLine()) { <a name="l02146"></a>02146 r=data.line; <a name="l02147"></a>02147 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02148"></a>02148 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02149"></a>02149 }<span class="comment"></span> <a name="l02150"></a>02150 <span class="comment"> /**</span> <a name="l02151"></a>02151 <span class="comment"> * Gets the content as a polygon, returning false if the type is not adequate.</span> <a name="l02152"></a>02152 <span class="comment"> */</span> <a name="l02153"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aea4f58671cbc6b85f9f8f2d58a8dacc3">02153</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aea4f58671cbc6b85f9f8f2d58a8dacc3" title="Gets the content as a polygon, returning false if the type is not adequate.">getPolygon</a>(<a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p)<span class="keyword"> const </span>{ <a name="l02154"></a>02154 <span class="keywordflow">if</span> (isPolygon()) { <a name="l02155"></a>02155 p=*(data.polygon); <a name="l02156"></a>02156 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02157"></a>02157 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02158"></a>02158 }<span class="comment"></span> <a name="l02159"></a>02159 <span class="comment"> /**</span> <a name="l02160"></a>02160 <span class="comment"> * Gets the content as a plane, returning false if the type is not adequate.</span> <a name="l02161"></a>02161 <span class="comment"> */</span> <a name="l02162"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a338da7e44d81c0848934aceacb548bcb">02162</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a338da7e44d81c0848934aceacb548bcb" title="Gets the content as a plane, returning false if the type is not adequate.">getPlane</a>(<a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &p)<span class="keyword"> const </span>{ <a name="l02163"></a>02163 <span class="keywordflow">if</span> (isPlane()) { <a name="l02164"></a>02164 p=data.plane; <a name="l02165"></a>02165 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02166"></a>02166 } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02167"></a>02167 }<span class="comment"></span> <a name="l02168"></a>02168 <span class="comment"> /**</span> <a name="l02169"></a>02169 <span class="comment"> * Assigns another object, creating a new pointer if needed.</span> <a name="l02170"></a>02170 <span class="comment"> */</span> <a name="l02171"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a0283e622498561c1f130e5402d443487">02171</a> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a0283e622498561c1f130e5402d443487" title="Assigns another object, creating a new pointer if needed.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">TObject3D</a> &obj) { <a name="l02172"></a>02172 <span class="keywordflow">if</span> (<span class="keyword">this</span>==&obj) <span class="keywordflow">return</span>; <a name="l02173"></a>02173 destroy(); <a name="l02174"></a>02174 <span class="keywordflow">switch</span> (type=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#acc2d1bbbae29e99b1e10b0a1f21e2f94" title="Object type identifier.">type</a>) { <a name="l02175"></a>02175 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l02176"></a>02176 data.point=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a2d4f1ebd5a693727168920a03d65c104" title="Union containing pointer to actual data.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a9bf83bb6456777826a7f27dd1ec3b0e7">point</a>; <a name="l02177"></a>02177 <span class="keywordflow">break</span>; <a name="l02178"></a>02178 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l02179"></a>02179 data.segment=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a2d4f1ebd5a693727168920a03d65c104" title="Union containing pointer to actual data.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aae896b7288413bf7ecc66d9912433f18">segment</a>; <a name="l02180"></a>02180 <span class="keywordflow">break</span>; <a name="l02181"></a>02181 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l02182"></a>02182 data.line=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a2d4f1ebd5a693727168920a03d65c104" title="Union containing pointer to actual data.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a34fa68120ef7d84fea9c0f9b9cd27c62">line</a>; <a name="l02183"></a>02183 <span class="keywordflow">break</span>; <a name="l02184"></a>02184 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l02185"></a>02185 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(*(obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a2d4f1ebd5a693727168920a03d65c104" title="Union containing pointer to actual data.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad21f939efa13a8a24cde2257a4c88eac">polygon</a>)); <a name="l02186"></a>02186 <span class="keywordflow">break</span>; <a name="l02187"></a>02187 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>: <a name="l02188"></a>02188 data.plane=obj.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a2d4f1ebd5a693727168920a03d65c104" title="Union containing pointer to actual data.">data</a>.<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a3878492604c5d553e0dfbfd20c5e0c2e">plane</a>; <a name="l02189"></a>02189 <span class="keywordflow">break</span>; <a name="l02190"></a>02190 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>: <a name="l02191"></a>02191 <span class="keywordflow">break</span>; <a name="l02192"></a>02192 <span class="keywordflow">default</span>: <a name="l02193"></a>02193 <a class="code" href="mrpt__macros_8h.html#aaa3f404ea85a6575a7139f8d101370ba">THROW_EXCEPTION</a>(<span class="stringliteral">"Invalid TObject3D object"</span>); <a name="l02194"></a>02194 } <a name="l02195"></a>02195 }<span class="comment"></span> <a name="l02196"></a>02196 <span class="comment"> /**</span> <a name="l02197"></a>02197 <span class="comment"> * Assigns a point to this object.</span> <a name="l02198"></a>02198 <span class="comment"> */</span> <a name="l02199"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a10e983f576476c02b019bfd6983ae801">02199</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a10e983f576476c02b019bfd6983ae801" title="Assigns a point to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &p) { <a name="l02200"></a>02200 destroy(); <a name="l02201"></a>02201 type=<a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>; <a name="l02202"></a>02202 data.point=p; <a name="l02203"></a>02203 }<span class="comment"></span> <a name="l02204"></a>02204 <span class="comment"> /**</span> <a name="l02205"></a>02205 <span class="comment"> * Assigns a segment to this object.</span> <a name="l02206"></a>02206 <span class="comment"> */</span> <a name="l02207"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a40e0d291691a7d6f95348c721adc41ce">02207</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a40e0d291691a7d6f95348c721adc41ce" title="Assigns a segment to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s) { <a name="l02208"></a>02208 destroy(); <a name="l02209"></a>02209 type=<a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>; <a name="l02210"></a>02210 data.segment=s; <a name="l02211"></a>02211 }<span class="comment"></span> <a name="l02212"></a>02212 <span class="comment"> /**</span> <a name="l02213"></a>02213 <span class="comment"> * Assigns a line to this object.</span> <a name="l02214"></a>02214 <span class="comment"> */</span> <a name="l02215"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aa924d262a5fc4342de9e430f9507b297">02215</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aa924d262a5fc4342de9e430f9507b297" title="Assigns a line to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">TLine3D</a> &l) { <a name="l02216"></a>02216 destroy(); <a name="l02217"></a>02217 type=<a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>; <a name="l02218"></a>02218 data.line=l; <a name="l02219"></a>02219 }<span class="comment"></span> <a name="l02220"></a>02220 <span class="comment"> /**</span> <a name="l02221"></a>02221 <span class="comment"> * Assigns a polygon to this object.</span> <a name="l02222"></a>02222 <span class="comment"> */</span> <a name="l02223"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a011d8a9279e6580715d96d28caf51342">02223</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a011d8a9279e6580715d96d28caf51342" title="Assigns a polygon to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p) { <a name="l02224"></a>02224 destroy(); <a name="l02225"></a>02225 type=<a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>; <a name="l02226"></a>02226 data.polygon=<span class="keyword">new</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>(p); <a name="l02227"></a>02227 }<span class="comment"></span> <a name="l02228"></a>02228 <span class="comment"> /**</span> <a name="l02229"></a>02229 <span class="comment"> * Assigns a plane to this object.</span> <a name="l02230"></a>02230 <span class="comment"> */</span> <a name="l02231"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a46b85d7fd163760b7eb7f91ce52e4d64">02231</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#a46b85d7fd163760b7eb7f91ce52e4d64" title="Assigns a plane to this object.">operator=</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &p) { <a name="l02232"></a>02232 destroy(); <a name="l02233"></a>02233 type=<a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>; <a name="l02234"></a>02234 data.plane=p; <a name="l02235"></a>02235 }<span class="comment"></span> <a name="l02236"></a>02236 <span class="comment"> /**</span> <a name="l02237"></a>02237 <span class="comment"> * Projects into 2D space.</span> <a name="l02238"></a>02238 <span class="comment"> * \throw std::logic_error if the 3D object loses its properties when projecting into 2D space (for example, it's a plane or a vertical line).</span> <a name="l02239"></a>02239 <span class="comment"> */</span> <a name="l02240"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad5ba52188a351e48e6d7656e5b360a43">02240</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#ad5ba52188a351e48e6d7656e5b360a43" title="Projects into 2D space.">generate2DObject</a>(<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a> &obj)<span class="keyword"> const </span>{ <a name="l02241"></a>02241 <span class="keywordflow">switch</span> (type) { <a name="l02242"></a>02242 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga2dbf1225dd78e1ae2cb5e7d0b7ddea52" title="Object type identifier for TPoint2D or TPoint3D.">GEOMETRIC_TYPE_POINT</a>: <a name="l02243"></a>02243 obj=<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a>(data.point); <a name="l02244"></a>02244 <span class="keywordflow">break</span>; <a name="l02245"></a>02245 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gabdfe15c4a3eebe6168b00dd3a64224fc" title="Object type identifier for TSegment2D or TSegment3D.">GEOMETRIC_TYPE_SEGMENT</a>: <a name="l02246"></a>02246 obj=<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a>(data.segment); <a name="l02247"></a>02247 <span class="keywordflow">break</span>; <a name="l02248"></a>02248 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga39c624c65577d653fdd4959db170f99e" title="Object type identifier for TLine2D or TLine3D.">GEOMETRIC_TYPE_LINE</a>: <a name="l02249"></a>02249 obj=<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>(data.line); <a name="l02250"></a>02250 <span class="keywordflow">break</span>; <a name="l02251"></a>02251 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#ga8a10a9c561cb5d704d17328857b4eb64" title="Object type identifier for TPolygon2D or TPolygon3D.">GEOMETRIC_TYPE_POLYGON</a>: <a name="l02252"></a>02252 obj=<a class="code" href="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a>(*(data.polygon)); <a name="l02253"></a>02253 <span class="keywordflow">break</span>; <a name="l02254"></a>02254 <span class="keywordflow">case</span> <a class="code" href="group__geometry__grp.html#gaf25b3e2c558bc58ce4f5251cc62ac2cd" title="Object type identifier for TPlane.">GEOMETRIC_TYPE_PLANE</a>: <a name="l02255"></a>02255 <span class="keywordflow">throw</span> <a class="code" href="classstd_1_1logic__error.html" title="STL class.">std::logic_error</a>(<span class="stringliteral">"Too many dimensions"</span>); <a name="l02256"></a>02256 <span class="keywordflow">default</span>: <a name="l02257"></a>02257 obj=<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">TObject2D</a>(); <a name="l02258"></a>02258 <span class="keywordflow">break</span>; <a name="l02259"></a>02259 } <a name="l02260"></a>02260 }<span class="comment"></span> <a name="l02261"></a>02261 <span class="comment"> /**</span> <a name="l02262"></a>02262 <span class="comment"> * Constructs from another object.</span> <a name="l02263"></a>02263 <span class="comment"> */</span> <a name="l02264"></a><a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aeb8a6205bff0a8ae1dbd244d3b8143f2">02264</a> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html#aeb8a6205bff0a8ae1dbd244d3b8143f2" title="Constructs from another object.">TObject3D</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">TObject3D</a> &obj):type(<a class="code" href="group__geometry__grp.html#ga6fb47c39fe7b701f2ad23f02787ec63a" title="Object type identifier for empty TObject2D or TObject3D.">GEOMETRIC_TYPE_UNDEFINED</a>) { <a name="l02265"></a>02265 operator=(obj); <a name="l02266"></a>02266 }<span class="comment"></span> <a name="l02267"></a>02267 <span class="comment"> /**</span> <a name="l02268"></a>02268 <span class="comment"> * Static method to retrieve every point included in a vector of objects.</span> <a name="l02269"></a>02269 <span class="comment"> */</span> <a name="l02270"></a>02270 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &pnts);<span class="comment"></span> <a name="l02271"></a>02271 <span class="comment"> /**</span> <a name="l02272"></a>02272 <span class="comment"> * Static method to retrieve every segment included in a vector of objects.</span> <a name="l02273"></a>02273 <span class="comment"> */</span> <a name="l02274"></a>02274 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &sgms);<span class="comment"></span> <a name="l02275"></a>02275 <span class="comment"> /**</span> <a name="l02276"></a>02276 <span class="comment"> * Static method to retrieve every line included in a vector of objects.</span> <a name="l02277"></a>02277 <span class="comment"> */</span> <a name="l02278"></a>02278 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine3D></a> &lins);<span class="comment"></span> <a name="l02279"></a>02279 <span class="comment"> /**</span> <a name="l02280"></a>02280 <span class="comment"> * Static method to retrieve every plane included in a vector of objects.</span> <a name="l02281"></a>02281 <span class="comment"> */</span> <a name="l02282"></a>02282 <span class="keyword">static</span> <span class="keywordtype">void</span> getPlanes(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPlane></a> &plns);<span class="comment"></span> <a name="l02283"></a>02283 <span class="comment"> /**</span> <a name="l02284"></a>02284 <span class="comment"> * Static method to retrieve every polygon included in a vector of objects.</span> <a name="l02285"></a>02285 <span class="comment"> */</span> <a name="l02286"></a>02286 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys);<span class="comment"></span> <a name="l02287"></a>02287 <span class="comment"> /**</span> <a name="l02288"></a>02288 <span class="comment"> * Static method to retrieve every point included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l02289"></a>02289 <span class="comment"> */</span> <a name="l02290"></a>02290 <span class="keyword">static</span> <span class="keywordtype">void</span> getPoints(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &pnts,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l02291"></a>02291 <span class="comment"> /**</span> <a name="l02292"></a>02292 <span class="comment"> * Static method to retrieve every segment included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l02293"></a>02293 <span class="comment"> */</span> <a name="l02294"></a>02294 <span class="keyword">static</span> <span class="keywordtype">void</span> getSegments(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &sgms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l02295"></a>02295 <span class="comment"> /**</span> <a name="l02296"></a>02296 <span class="comment"> * Static method to retrieve every line included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l02297"></a>02297 <span class="comment"> */</span> <a name="l02298"></a>02298 <span class="keyword">static</span> <span class="keywordtype">void</span> getLines(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TLine3D></a> &lins,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l02299"></a>02299 <span class="comment"> /**</span> <a name="l02300"></a>02300 <span class="comment"> * Static method to retrieve every plane included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l02301"></a>02301 <span class="comment"> */</span> <a name="l02302"></a>02302 <span class="keyword">static</span> <span class="keywordtype">void</span> getPlanes(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPlane></a> &plns,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder);<span class="comment"></span> <a name="l02303"></a>02303 <span class="comment"> /**</span> <a name="l02304"></a>02304 <span class="comment"> * Static method to retrieve every polygon included in a vector of objects, returning the remaining objects in another argument.</span> <a name="l02305"></a>02305 <span class="comment"> */</span> <a name="l02306"></a>02306 <span class="keyword">static</span> <span class="keywordtype">void</span> getPolygons(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder); <a name="l02307"></a>02307 }; <a name="l02308"></a>02308 <a name="l02309"></a>02309 <span class="preprocessor">#endif</span> <a name="l02310"></a>02310 <span class="preprocessor"></span> <a name="l02311"></a>02311 <a name="l02312"></a>02312 <span class="comment">//Streaming functions</span><span class="comment"></span> <a name="l02313"></a>02313 <span class="comment"> /**</span> <a name="l02314"></a>02314 <span class="comment"> * TPoint2D binary input.</span> <a name="l02315"></a>02315 <span class="comment"> */</span> <a name="l02316"></a>02316 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">mrpt::math::TPoint2D</a> &o);<span class="comment"></span> <a name="l02317"></a>02317 <span class="comment"> /**</span> <a name="l02318"></a>02318 <span class="comment"> * TPoint2D binary output.</span> <a name="l02319"></a>02319 <span class="comment"> */</span> <a name="l02320"></a>02320 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">mrpt::math::TPoint2D</a> &o); <a name="l02321"></a>02321 <span class="comment"></span> <a name="l02322"></a>02322 <span class="comment"> /**</span> <a name="l02323"></a>02323 <span class="comment"> * TPoint3D binary input.</span> <a name="l02324"></a>02324 <span class="comment"> */</span> <a name="l02325"></a>02325 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">mrpt::math::TPoint3D</a> &o);<span class="comment"></span> <a name="l02326"></a>02326 <span class="comment"> /**</span> <a name="l02327"></a>02327 <span class="comment"> * TPoint3D binary output.</span> <a name="l02328"></a>02328 <span class="comment"> */</span> <a name="l02329"></a>02329 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">mrpt::math::TPoint3D</a> &o); <a name="l02330"></a>02330 <span class="comment"></span> <a name="l02331"></a>02331 <span class="comment"> /**</span> <a name="l02332"></a>02332 <span class="comment"> * TPose2D binary input.</span> <a name="l02333"></a>02333 <span class="comment"> */</span> <a name="l02334"></a>02334 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">mrpt::math::TPose2D</a> &o);<span class="comment"></span> <a name="l02335"></a>02335 <span class="comment"> /**</span> <a name="l02336"></a>02336 <span class="comment"> * TPose2D binary output.</span> <a name="l02337"></a>02337 <span class="comment"> */</span> <a name="l02338"></a>02338 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_pose2_d.html" title="Lightweight 2D pose.">mrpt::math::TPose2D</a> &o); <a name="l02339"></a>02339 <span class="comment"></span> <a name="l02340"></a>02340 <span class="comment"> /**</span> <a name="l02341"></a>02341 <span class="comment"> * TPose3D binary input.</span> <a name="l02342"></a>02342 <span class="comment"> */</span> <a name="l02343"></a>02343 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">mrpt::math::TPose3D</a> &o);<span class="comment"></span> <a name="l02344"></a>02344 <span class="comment"> /**</span> <a name="l02345"></a>02345 <span class="comment"> * TPose3D binary output.</span> <a name="l02346"></a>02346 <span class="comment"> */</span> <a name="l02347"></a>02347 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">mrpt::math::TPose3D</a> &o); <a name="l02348"></a>02348 <span class="comment"></span> <a name="l02349"></a>02349 <span class="comment"> /**</span> <a name="l02350"></a>02350 <span class="comment"> * TSegment2D binary input.</span> <a name="l02351"></a>02351 <span class="comment"> */</span> <a name="l02352"></a><a class="code" href="group__geometry__grp.html#ga8d71c9fdf214a7b85d32eac48a0ac633">02352</a> <span class="keyword">inline</span> 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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">mrpt::math::TSegment2D</a> &s) { <a name="l02353"></a>02353 <span class="keywordflow">return</span> in>>s.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>>>s.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>; <a name="l02354"></a>02354 }<span class="comment"></span> <a name="l02355"></a>02355 <span class="comment"> /**</span> <a name="l02356"></a>02356 <span class="comment"> * TSegment2D binary output.</span> <a name="l02357"></a>02357 <span class="comment"> */</span> <a name="l02358"></a><a class="code" href="group__geometry__grp.html#ga0c679646ca7bf18ad88f7d74bf8c4051">02358</a> <span class="keyword">inline</span> 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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">mrpt::math::TSegment2D</a> &s) { <a name="l02359"></a>02359 <span class="keywordflow">return</span> out<<s.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a><<s.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>; <a name="l02360"></a>02360 } <a name="l02361"></a>02361 <span class="comment"></span> <a name="l02362"></a>02362 <span class="comment"> /**</span> <a name="l02363"></a>02363 <span class="comment"> * TLine2D binary input.</span> <a name="l02364"></a>02364 <span class="comment"> */</span> <a name="l02365"></a><a class="code" href="group__geometry__grp.html#gaefdce466c1d15aa5f9a15d780e16a0cd">02365</a> <span class="keyword">inline</span> 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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">mrpt::math::TLine2D</a> &l) { <a name="l02366"></a>02366 <span class="keywordflow">return</span> in>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[0]>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[1]>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[2]; <a name="l02367"></a>02367 }<span class="comment"></span> <a name="l02368"></a>02368 <span class="comment"> /**</span> <a name="l02369"></a>02369 <span class="comment"> * TLine2D binary output.</span> <a name="l02370"></a>02370 <span class="comment"> */</span> <a name="l02371"></a><a class="code" href="group__geometry__grp.html#gafa318a04ca6d1d96394319b1d59f4a6a">02371</a> <span class="keyword">inline</span> 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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">mrpt::math::TLine2D</a> &l) { <a name="l02372"></a>02372 <span class="keywordflow">return</span> out<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[0]<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[1]<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#ad0719679cd1e0826145e06a785937a00" title="Line coefficients, stored as an array: .">coefs</a>[2]; <a name="l02373"></a>02373 } <a name="l02374"></a>02374 <span class="comment"></span> <a name="l02375"></a>02375 <span class="comment"> /**</span> <a name="l02376"></a>02376 <span class="comment"> * TObject2D binary input.</span> <a name="l02377"></a>02377 <span class="comment"> */</span> <a name="l02378"></a>02378 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">mrpt::math::TObject2D</a> &o);<span class="comment"></span> <a name="l02379"></a>02379 <span class="comment"> /**</span> <a name="l02380"></a>02380 <span class="comment"> * TObject2D binary input.</span> <a name="l02381"></a>02381 <span class="comment"> */</span> <a name="l02382"></a>02382 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_object2_d.html" title="Standard type for storing any lightweight 2D type.">mrpt::math::TObject2D</a> &o); <a name="l02383"></a>02383 <span class="comment"></span> <a name="l02384"></a>02384 <span class="comment"> /**</span> <a name="l02385"></a>02385 <span class="comment"> * TSegment3D binary input.</span> <a name="l02386"></a>02386 <span class="comment"> */</span> <a name="l02387"></a><a class="code" href="group__geometry__grp.html#ga252014f7c27f09c8098b7a1285e2aba5">02387</a> <span class="keyword">inline</span> 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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">mrpt::math::TSegment3D</a> &s) { <a name="l02388"></a>02388 <span class="keywordflow">return</span> in>>s.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>>>s.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>; <a name="l02389"></a>02389 }<span class="comment"></span> <a name="l02390"></a>02390 <span class="comment"> /**</span> <a name="l02391"></a>02391 <span class="comment"> * TSegment3D binary output.</span> <a name="l02392"></a>02392 <span class="comment"> */</span> <a name="l02393"></a><a class="code" href="group__geometry__grp.html#ga94641e5a5230bd42caaf02587af63240">02393</a> <span class="keyword">inline</span> 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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">mrpt::math::TSegment3D</a> &s) { <a name="l02394"></a>02394 <span class="keywordflow">return</span> out<<s.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a><<s.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>; <a name="l02395"></a>02395 } <a name="l02396"></a>02396 <span class="comment"></span> <a name="l02397"></a>02397 <span class="comment"> /**</span> <a name="l02398"></a>02398 <span class="comment"> * TLine3D binary input.</span> <a name="l02399"></a>02399 <span class="comment"> */</span> <a name="l02400"></a><a class="code" href="group__geometry__grp.html#ga904a984edb7f67f274b002e36dc0f685">02400</a> <span class="keyword">inline</span> 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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">mrpt::math::TLine3D</a> &l) { <a name="l02401"></a>02401 <span class="keywordflow">return</span> in>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad82681ef5a27b2bd32e29961f2bf3ec4" title="Base point.">pBase</a>>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[0]>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[1]>>l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[2]; <a name="l02402"></a>02402 }<span class="comment"></span> <a name="l02403"></a>02403 <span class="comment"> /**</span> <a name="l02404"></a>02404 <span class="comment"> * TLine3D binary output.</span> <a name="l02405"></a>02405 <span class="comment"> */</span> <a name="l02406"></a><a class="code" href="group__geometry__grp.html#ga432e65f2a9cab4461b8fd8bba7bd596b">02406</a> <span class="keyword">inline</span> 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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">mrpt::math::TLine3D</a> &l) { <a name="l02407"></a>02407 <span class="keywordflow">return</span> out<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#ad82681ef5a27b2bd32e29961f2bf3ec4" title="Base point.">pBase</a><<l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[0]<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[1]<<l.<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html#a455f8295bb6777994e3aabeee8df43fe" title="Director vector.">director</a>[2]; <a name="l02408"></a>02408 } <a name="l02409"></a>02409 <span class="comment"></span> <a name="l02410"></a>02410 <span class="comment"> /**</span> <a name="l02411"></a>02411 <span class="comment"> * TPlane binary input.</span> <a name="l02412"></a>02412 <span class="comment"> */</span> <a name="l02413"></a><a class="code" href="group__geometry__grp.html#gaff141872fd7b9cca804e19cb72a4149f">02413</a> <span class="keyword">inline</span> 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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">mrpt::math::TPlane</a> &p) { <a name="l02414"></a>02414 <span class="keywordflow">return</span> in>>p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[0]>>p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[1]>>p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[2]>>p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[3]; <a name="l02415"></a>02415 }<span class="comment"></span> <a name="l02416"></a>02416 <span class="comment"> /**</span> <a name="l02417"></a>02417 <span class="comment"> * TPlane binary output.</span> <a name="l02418"></a>02418 <span class="comment"> */</span> <a name="l02419"></a><a class="code" href="group__geometry__grp.html#ga8c6491eb156942e441020308912a82eb">02419</a> <span class="keyword">inline</span> 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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">mrpt::math::TPlane</a> &p) { <a name="l02420"></a>02420 <span class="keywordflow">return</span> out<<p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[0]<<p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[1]<<p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[2]<<p.<a class="code" href="structmrpt_1_1math_1_1_t_plane.html#aa239e4cc73b5f6e72069feb9423c28a9" title="Plane coefficients, stored as an array: .">coefs</a>[3]; <a name="l02421"></a>02421 } <a name="l02422"></a>02422 <span class="comment"></span> <a name="l02423"></a>02423 <span class="comment"> /**</span> <a name="l02424"></a>02424 <span class="comment"> * TObject3D binary input.</span> <a name="l02425"></a>02425 <span class="comment"> */</span> <a name="l02426"></a>02426 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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_1math.html#ab55e39255f4b544e7693867d22a70b91">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,<a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">mrpt::math::TObject3D</a> &o);<span class="comment"></span> <a name="l02427"></a>02427 <span class="comment"> /**</span> <a name="l02428"></a>02428 <span class="comment"> * TObject3D binary output.</span> <a name="l02429"></a>02429 <span class="comment"> */</span> <a name="l02430"></a>02430 <a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_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="group__geometry__grp.html#ga04abf9e51a93d1d57a9f1b27236a5a36">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> <a class="code" href="structmrpt_1_1math_1_1_t_object3_d.html" title="Standard object for storing any 3D lightweight object.">mrpt::math::TObject3D</a> &o); <a name="l02431"></a>02431 <a name="l02432"></a>02432 <span class="comment"></span> <a name="l02433"></a>02433 <span class="comment"> /** @} */</span> <span class="comment">// end of grouping</span> <a name="l02434"></a>02434 <a name="l02435"></a>02435 } <span class="comment">//end of namespace math</span> <a name="l02436"></a>02436 <a name="l02437"></a>02437 <span class="keyword">namespace </span>utils <a name="l02438"></a>02438 { <a name="l02439"></a>02439 <span class="keyword">using namespace </span>::mrpt::math; <a name="l02440"></a>02440 <a name="l02441"></a>02441 <span class="comment">// Specialization must occur in the same namespace</span> <a name="l02442"></a>02442 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPoint2D) <a name="l02443"></a>02443 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPoint3D) <a name="l02444"></a>02444 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPose2D) <a name="l02445"></a>02445 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPose3D) <a name="l02446"></a>02446 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TSegment2D) <a name="l02447"></a>02447 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TLine2D) <a name="l02448"></a>02448 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPolygon2D) <a name="l02449"></a>02449 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TObject2D) <a name="l02450"></a>02450 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(<a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a>) <a name="l02451"></a>02451 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a>) <a name="l02452"></a>02452 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(TPlane) <a name="l02453"></a>02453 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(<a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a>) <a name="l02454"></a>02454 <a class="code" href="_c_serializable_8h.html#a3d50ead2a44af4340ef8e3a88b78df10">MRPT_DECLARE_TTYPENAME</a>(<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a>) <a name="l02455"></a>02455 <a name="l02456"></a>02456 } <span class="comment">// end of namespace utils</span> <a name="l02457"></a>02457 <a name="l02458"></a>02458 } <span class="comment">//end of namespace</span> <a name="l02459"></a>02459 <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>