<!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>geometry.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">geometry.h</div> </div> </div> <div class="contents"> <a href="geometry_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 GEO_H</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define GEO_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="_c_matrix_template_numeric_8h.html">mrpt/math/CMatrixTemplateNumeric.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="_c_point2_d_8h.html">mrpt/poses/CPoint2D.h</a>></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="_c_point3_d_8h.html">mrpt/poses/CPoint3D.h</a>></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="_c_pose2_d_8h.html">mrpt/poses/CPose2D.h</a>></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="_c_pose3_d_8h.html">mrpt/poses/CPose3D.h</a>></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="lightweight__geom__data_8h.html">mrpt/math/lightweight_geom_data.h</a>></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="_c_sparse_matrix_template_8h.html">mrpt/math/CSparseMatrixTemplate.h</a>></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <<a class="code" href="base_2include_2mrpt_2math_2utils_8h.html">mrpt/math/utils.h</a>></span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="comment">/*---------------------------------------------------------------</span> <a name="l00042"></a>00042 <span class="comment"> Class</span> <a name="l00043"></a>00043 <span class="comment"> ---------------------------------------------------------------*/</span> <a name="l00044"></a>00044 <span class="keyword">namespace </span>mrpt <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <span class="keyword">namespace </span>math <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="keyword">using</span> std::vector; <a name="l00049"></a>00049 <span class="keyword">using namespace </span>mrpt::utils; <a name="l00050"></a>00050 <span class="keyword">using namespace </span>mrpt::poses; <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment"></span> <a name="l00053"></a>00053 <span class="comment"> /** \addtogroup geometry_grp Geometry: lines, planes, intersections, SLERP, "lightweight" point & pose classes</span> <a name="l00054"></a>00054 <span class="comment"> * \ingroup mrpt_base_grp</span> <a name="l00055"></a>00055 <span class="comment"> * @{ */</span> <a name="l00056"></a>00056 <span class="comment"></span> <a name="l00057"></a>00057 <span class="comment"> /**</span> <a name="l00058"></a>00058 <span class="comment"> * Global epsilon to overcome small precision errors</span> <a name="l00059"></a>00059 <span class="comment"> */</span> <a name="l00060"></a>00060 <span class="keyword">extern</span> <span class="keywordtype">double</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#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>; <a name="l00061"></a>00061 <span class="comment"></span> <a name="l00062"></a>00062 <span class="comment"> /**</span> <a name="l00063"></a>00063 <span class="comment"> * Slightly heavyweight type to speed-up calculations with polygons in 3D</span> <a name="l00064"></a>00064 <span class="comment"> * \sa TPolygon3D,TPlane</span> <a name="l00065"></a>00065 <span class="comment"> */</span> <a name="l00066"></a>00066 <span class="keyword">class </span><a class="code" href="base_2include_2mrpt_2base_2link__pragmas_8h.html#a6045fa0129b1a3d6c8bf895470e66574">BASE_IMPEXP</a> TPolygonWithPlane { <a name="l00067"></a>00067 <span class="keyword">public</span>:<span class="comment"></span> <a name="l00068"></a>00068 <span class="comment"> /**</span> <a name="l00069"></a>00069 <span class="comment"> * Actual polygon.</span> <a name="l00070"></a>00070 <span class="comment"> */</span> <a name="l00071"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a2555b381a270ba734e75a25f2e4db813">00071</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="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a2555b381a270ba734e75a25f2e4db813" title="Actual polygon.">poly</a>;<span class="comment"></span> <a name="l00072"></a>00072 <span class="comment"> /**</span> <a name="l00073"></a>00073 <span class="comment"> * Plane containing the polygon.</span> <a name="l00074"></a>00074 <span class="comment"> */</span> <a name="l00075"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a7450ad8c9c68b4fef89e2074d1220d48">00075</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="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a7450ad8c9c68b4fef89e2074d1220d48" title="Plane containing the polygon.">plane</a>;<span class="comment"></span> <a name="l00076"></a>00076 <span class="comment"> /**</span> <a name="l00077"></a>00077 <span class="comment"> * Plane's pose.</span> <a name="l00078"></a>00078 <span class="comment"> * \sa inversePose</span> <a name="l00079"></a>00079 <span class="comment"> */</span> <a name="l00080"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a604c925a13733fb6690974201034804e">00080</a> mrpt<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).">::poses::CPose3D</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a604c925a13733fb6690974201034804e" title="Plane's pose.">pose</a>;<span class="comment"></span> <a name="l00081"></a>00081 <span class="comment"> /**</span> <a name="l00082"></a>00082 <span class="comment"> * Plane's inverse pose.</span> <a name="l00083"></a>00083 <span class="comment"> * \sa pose</span> <a name="l00084"></a>00084 <span class="comment"> */</span> <a name="l00085"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a7e7f603a7566325456990b062ed0b72d">00085</a> mrpt<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).">::poses::CPose3D</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a7e7f603a7566325456990b062ed0b72d" title="Plane's inverse pose.">inversePose</a>;<span class="comment"></span> <a name="l00086"></a>00086 <span class="comment"> /**</span> <a name="l00087"></a>00087 <span class="comment"> * Polygon, after being projected to the plane using inversePose.</span> <a name="l00088"></a>00088 <span class="comment"> * \sa inversePose</span> <a name="l00089"></a>00089 <span class="comment"> */</span> <a name="l00090"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a60444c7eddd66c687a3a0d265faec59c">00090</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="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a60444c7eddd66c687a3a0d265faec59c" title="Polygon, after being projected to the plane using inversePose.">poly2D</a>;<span class="comment"></span> <a name="l00091"></a>00091 <span class="comment"> /**</span> <a name="l00092"></a>00092 <span class="comment"> * Constructor. Takes a polygon and computes each parameter.</span> <a name="l00093"></a>00093 <span class="comment"> */</span> <a name="l00094"></a>00094 <a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html" title="Slightly heavyweight type to speed-up calculations with polygons in 3D.">TPolygonWithPlane</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="l00095"></a>00095 <span class="comment"> /**</span> <a name="l00096"></a>00096 <span class="comment"> * Basic constructor. Needed to create containers.</span> <a name="l00097"></a>00097 <span class="comment"> * \sa TPolygonWithPlane(const TPolygon3D &)</span> <a name="l00098"></a>00098 <span class="comment"> */</span> <a name="l00099"></a><a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a2d258c77ab51958f314dfeca508c7445">00099</a> <a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a2d258c77ab51958f314dfeca508c7445" title="Basic constructor.">TPolygonWithPlane</a>() {}<span class="comment"></span> <a name="l00100"></a>00100 <span class="comment"> /**</span> <a name="l00101"></a>00101 <span class="comment"> * Static method for vectors. Takes a set of polygons and creates every TPolygonWithPlane</span> <a name="l00102"></a>00102 <span class="comment"> */</span> <a name="l00103"></a>00103 <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.">vector<TPolygon3D></a> &oldPolys,<a class="code" href="classstd_1_1vector.html">vector<TPolygonWithPlane></a> &newPolys); <a name="l00104"></a>00104 }; <a name="l00105"></a>00105 <span class="comment"></span> <a name="l00106"></a>00106 <span class="comment"> /** @name Simple intersection operations, relying basically on geometrical operations.</span> <a name="l00107"></a>00107 <span class="comment"> @{</span> <a name="l00108"></a>00108 <span class="comment"> */</span><span class="comment"></span> <a name="l00109"></a>00109 <span class="comment"> /**</span> <a name="l00110"></a>00110 <span class="comment"> * Gets the intersection between two 3D segments.</span> <a name="l00111"></a>00111 <span class="comment"> * \sa TObject3D</span> <a name="l00112"></a>00112 <span class="comment"> */</span> <a name="l00113"></a>00113 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00114"></a>00114 <span class="comment"> /**</span> <a name="l00115"></a>00115 <span class="comment"> * Gets the intersection between a 3D segment and a plane.</span> <a name="l00116"></a>00116 <span class="comment"> * \sa TObject3D</span> <a name="l00117"></a>00117 <span class="comment"> */</span> <a name="l00118"></a>00118 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s1,<span class="keyword">const</span> TPlane &p2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00119"></a>00119 <span class="comment"> /**</span> <a name="l00120"></a>00120 <span class="comment"> * Gets the intersection between a 3D segment and a 3D line.</span> <a name="l00121"></a>00121 <span class="comment"> * \sa TObject3D</span> <a name="l00122"></a>00122 <span class="comment"> */</span> <a name="l00123"></a>00123 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00124"></a>00124 <span class="comment"> /**</span> <a name="l00125"></a>00125 <span class="comment"> * Gets the intersection between a plane and a 3D segment.</span> <a name="l00126"></a>00126 <span class="comment"> * \sa TObject3D</span> <a name="l00127"></a>00127 <span class="comment"> */</span> <a name="l00128"></a><a class="code" href="group__geometry__grp.html#ga5578db841cf79d522bbe330e8af74b37">00128</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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> &p1,<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 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="l00129"></a>00129 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(s2,p1,obj); <a name="l00130"></a>00130 }<span class="comment"></span> <a name="l00131"></a>00131 <span class="comment"> /**</span> <a name="l00132"></a>00132 <span class="comment"> * Gets the intersection between two planes.</span> <a name="l00133"></a>00133 <span class="comment"> * \sa TObject3D</span> <a name="l00134"></a>00134 <span class="comment"> */</span> <a name="l00135"></a>00135 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TPlane &p1,<span class="keyword">const</span> TPlane &p2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00136"></a>00136 <span class="comment"> /**</span> <a name="l00137"></a>00137 <span class="comment"> * Gets the intersection between a plane and a 3D line.</span> <a name="l00138"></a>00138 <span class="comment"> * \sa TObject3D</span> <a name="l00139"></a>00139 <span class="comment"> */</span> <a name="l00140"></a>00140 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TPlane &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &p2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00141"></a>00141 <span class="comment"> /**</span> <a name="l00142"></a>00142 <span class="comment"> * Gets the intersection between a 3D line and a 3D segment.</span> <a name="l00143"></a>00143 <span class="comment"> * \sa TObject3D</span> <a name="l00144"></a>00144 <span class="comment"> */</span> <a name="l00145"></a><a class="code" href="group__geometry__grp.html#ga2213e727c993392fe8a6ff82bd4a1ed2">00145</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s2,<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="l00146"></a>00146 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(s2,r1,obj); <a name="l00147"></a>00147 }<span class="comment"></span> <a name="l00148"></a>00148 <span class="comment"> /**</span> <a name="l00149"></a>00149 <span class="comment"> * Gets the intersection between a 3D line and a plane.</span> <a name="l00150"></a>00150 <span class="comment"> * \sa TObject3D</span> <a name="l00151"></a>00151 <span class="comment"> */</span> <a name="l00152"></a><a class="code" href="group__geometry__grp.html#ga95f158cb50fb69c1d79243f48385409e">00152</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &p2,<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="l00153"></a>00153 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,r1,obj); <a name="l00154"></a>00154 }<span class="comment"></span> <a name="l00155"></a>00155 <span class="comment"> /**</span> <a name="l00156"></a>00156 <span class="comment"> * Gets the intersection between two 3D lines.</span> <a name="l00157"></a>00157 <span class="comment"> * \sa TObject3D</span> <a name="l00158"></a>00158 <span class="comment"> */</span> <a name="l00159"></a>00159 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00160"></a>00160 <span class="comment"> /**</span> <a name="l00161"></a>00161 <span class="comment"> * Gets the intersection between two 2D lines.</span> <a name="l00162"></a>00162 <span class="comment"> * \sa TObject2D</span> <a name="l00163"></a>00163 <span class="comment"> */</span> <a name="l00164"></a>00164 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TLine2D &r1,<span class="keyword">const</span> TLine2D &r2,TObject2D &obj);<span class="comment"></span> <a name="l00165"></a>00165 <span class="comment"> /**</span> <a name="l00166"></a>00166 <span class="comment"> * Gets the intersection between a 2D line and a 2D segment.</span> <a name="l00167"></a>00167 <span class="comment"> * \sa TObject2D</span> <a name="l00168"></a>00168 <span class="comment"> */</span> <a name="l00169"></a>00169 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TLine2D &r1,<span class="keyword">const</span> TSegment2D &s2,TObject2D &obj);<span class="comment"></span> <a name="l00170"></a>00170 <span class="comment"> /**</span> <a name="l00171"></a>00171 <span class="comment"> * Gets the intersection between a 2D line and a 2D segment.</span> <a name="l00172"></a>00172 <span class="comment"> * \sa TObject2D</span> <a name="l00173"></a>00173 <span class="comment"> */</span> <a name="l00174"></a><a class="code" href="group__geometry__grp.html#ga7f0d0dba6bacd14ccd3c518dbfe76000">00174</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &r2,<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="l00175"></a>00175 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(r2,s1,obj); <a name="l00176"></a>00176 }<span class="comment"></span> <a name="l00177"></a>00177 <span class="comment"> /**</span> <a name="l00178"></a>00178 <span class="comment"> * Gets the intersection between two 2D segments.</span> <a name="l00179"></a>00179 <span class="comment"> * \sa TObject2D</span> <a name="l00180"></a>00180 <span class="comment"> */</span> <a name="l00181"></a>00181 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TSegment2D &s1,<span class="keyword">const</span> TSegment2D &s2,TObject2D &obj);<span class="comment"></span> <a name="l00182"></a>00182 <span class="comment"> /** @}</span> <a name="l00183"></a>00183 <span class="comment"> */</span> <a name="l00184"></a>00184 <span class="comment"></span> <a name="l00185"></a>00185 <span class="comment"> /** @name Angle retrieval methods. Methods which use TSegments will automatically use TLines' implicit constructors.</span> <a name="l00186"></a>00186 <span class="comment"> @{</span> <a name="l00187"></a>00187 <span class="comment"> */</span><span class="comment"></span> <a name="l00188"></a>00188 <span class="comment"> /**</span> <a name="l00189"></a>00189 <span class="comment"> * Computes the angle between two planes.</span> <a name="l00190"></a>00190 <span class="comment"> */</span> <a name="l00191"></a>00191 <span class="keywordtype">double</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#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</a>(<span class="keyword">const</span> TPlane &p1,<span class="keyword">const</span> TPlane &p2);<span class="comment"></span> <a name="l00192"></a>00192 <span class="comment"> /**</span> <a name="l00193"></a>00193 <span class="comment"> * Computes the angle between a plane and a 3D line or segment (implicit constructor will be used if passing a segment instead of a line).</span> <a name="l00194"></a>00194 <span class="comment"> */</span> <a name="l00195"></a>00195 <span class="keywordtype">double</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#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</a>(<span class="keyword">const</span> TPlane &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2);<span class="comment"></span> <a name="l00196"></a>00196 <span class="comment"> /**</span> <a name="l00197"></a>00197 <span class="comment"> * Computes the angle between a 3D line or segment and a plane (implicit constructor will be used if passing a segment instead of a line).</span> <a name="l00198"></a>00198 <span class="comment"> */</span> <a name="l00199"></a><a class="code" href="group__geometry__grp.html#ga92e221cabafb17be49a42740463bba64">00199</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</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_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &p2) { <a name="l00200"></a>00200 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</a>(p2,r1); <a name="l00201"></a>00201 }<span class="comment"></span> <a name="l00202"></a>00202 <span class="comment"> /**</span> <a name="l00203"></a>00203 <span class="comment"> * Computes the angle between two 3D lines or segments (implicit constructor will be used if passing a segment instead of a line).</span> <a name="l00204"></a>00204 <span class="comment"> */</span> <a name="l00205"></a>00205 <span class="keywordtype">double</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#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2);<span class="comment"></span> <a name="l00206"></a>00206 <span class="comment"> /**</span> <a name="l00207"></a>00207 <span class="comment"> * Computes the angle between two 2D lines or segments (implicit constructor will be used if passing a segment instead of a line).</span> <a name="l00208"></a>00208 <span class="comment"> */</span> <a name="l00209"></a>00209 <span class="keywordtype">double</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#gaef0c5b67b3e5066b473389fd82d7e694" title="Computes the angle between two planes.">getAngle</a>(<span class="keyword">const</span> TLine2D &r1,<span class="keyword">const</span> TLine2D &r2);<span class="comment"></span> <a name="l00210"></a>00210 <span class="comment"> /** @}</span> <a name="l00211"></a>00211 <span class="comment"> */</span> <a name="l00212"></a>00212 <span class="comment"></span> <a name="l00213"></a>00213 <span class="comment"> /** @name Creation of lines from poses.</span> <a name="l00214"></a>00214 <span class="comment"> @{</span> <a name="l00215"></a>00215 <span class="comment"> */</span><span class="comment"></span> <a name="l00216"></a>00216 <span class="comment"> /**</span> <a name="l00217"></a>00217 <span class="comment"> * Gets a 3D line corresponding to the X axis in a given pose. An implicit constructor is used if a TPose3D is given.</span> <a name="l00218"></a>00218 <span class="comment"> * \sa createFromPoseY,createFromPoseZ,createFromPoseAndVector</span> <a name="l00219"></a>00219 <span class="comment"> */</span> <a name="l00220"></a>00220 <span class="keywordtype">void</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#gaa1633ebc71f0ee7d470f30b2eea943a8" title="Gets a 3D line corresponding to the X axis in a given pose.">createFromPoseX</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r);<span class="comment"></span> <a name="l00221"></a>00221 <span class="comment"> /**</span> <a name="l00222"></a>00222 <span class="comment"> * Gets a 3D line corresponding to the Y axis in a given pose. An implicit constructor is used if a TPose3D is given.</span> <a name="l00223"></a>00223 <span class="comment"> * \sa createFromPoseX,createFromPoseZ,createFromPoseAndVector</span> <a name="l00224"></a>00224 <span class="comment"> */</span> <a name="l00225"></a>00225 <span class="keywordtype">void</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#gae5b442ae15de11a3346b1e3255a7df4c" title="Gets a 3D line corresponding to the Y axis in a given pose.">createFromPoseY</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r);<span class="comment"></span> <a name="l00226"></a>00226 <span class="comment"> /**</span> <a name="l00227"></a>00227 <span class="comment"> * Gets a 3D line corresponding to the Z axis in a given pose. An implicit constructor is used if a TPose3D is given.</span> <a name="l00228"></a>00228 <span class="comment"> * \sa createFromPoseX,createFromPoseY,createFromPoseAndVector</span> <a name="l00229"></a>00229 <span class="comment"> */</span> <a name="l00230"></a>00230 <span class="keywordtype">void</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#ga4ee6495c3cc59db23593a54b0956ca0a" title="Gets a 3D line corresponding to the Z axis in a given pose.">createFromPoseZ</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r);<span class="comment"></span> <a name="l00231"></a>00231 <span class="comment"> /**</span> <a name="l00232"></a>00232 <span class="comment"> * Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose. An implicit constructor is used if a TPose3D is given.</span> <a name="l00233"></a>00233 <span class="comment"> * \sa createFromPoseX,createFromPoseY,createFromPoseZ</span> <a name="l00234"></a>00234 <span class="comment"> */</span> <a name="l00235"></a>00235 <span class="keywordtype">void</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#gafef50d9c5a0bc347ae26a406bcda5266" title="Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose.">createFromPoseAndVector</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &p,<span class="keyword">const</span> <span class="keywordtype">double</span> (&vector)[3],<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r);<span class="comment"></span> <a name="l00236"></a>00236 <span class="comment"> /**</span> <a name="l00237"></a>00237 <span class="comment"> * Gets a 2D line corresponding to the X axis in a given pose. An implicit constructor is used if a CPose2D is given.</span> <a name="l00238"></a>00238 <span class="comment"> * \sa createFromPoseY,createFromPoseAndVector</span> <a name="l00239"></a>00239 <span class="comment"> */</span> <a name="l00240"></a>00240 <span class="keywordtype">void</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#gaa1633ebc71f0ee7d470f30b2eea943a8" title="Gets a 3D line corresponding to the X axis in a given pose.">createFromPoseX</a>(<span class="keyword">const</span> TPose2D &p,TLine2D &r);<span class="comment"></span> <a name="l00241"></a>00241 <span class="comment"> /**</span> <a name="l00242"></a>00242 <span class="comment"> * Gets a 2D line corresponding to the Y axis in a given pose. An implicit constructor is used if a CPose2D is given.</span> <a name="l00243"></a>00243 <span class="comment"> * \sa createFromPoseX,createFromPoseAndVector</span> <a name="l00244"></a>00244 <span class="comment"> */</span> <a name="l00245"></a>00245 <span class="keywordtype">void</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#gae5b442ae15de11a3346b1e3255a7df4c" title="Gets a 3D line corresponding to the Y axis in a given pose.">createFromPoseY</a>(<span class="keyword">const</span> TPose2D &p,TLine2D &r);<span class="comment"></span> <a name="l00246"></a>00246 <span class="comment"> /**</span> <a name="l00247"></a>00247 <span class="comment"> * Gets a 2D line corresponding to any arbitrary vector, in the base given the given pose. An implicit constructor is used if a CPose2D is given.</span> <a name="l00248"></a>00248 <span class="comment"> * \sa createFromPoseY,createFromPoseAndVector</span> <a name="l00249"></a>00249 <span class="comment"> */</span> <a name="l00250"></a>00250 <span class="keywordtype">void</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#gafef50d9c5a0bc347ae26a406bcda5266" title="Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose.">createFromPoseAndVector</a>(<span class="keyword">const</span> TPose2D &p,<span class="keyword">const</span> <span class="keywordtype">double</span> (&vector)[2],TLine2D &r);<span class="comment"></span> <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"></span> <a name="l00254"></a>00254 <span class="comment"> /** @name Other line or plane related methods.</span> <a name="l00255"></a>00255 <span class="comment"> @{</span> <a name="l00256"></a>00256 <span class="comment"> */</span><span class="comment"></span> <a name="l00257"></a>00257 <span class="comment"> /**</span> <a name="l00258"></a>00258 <span class="comment"> * Checks whether this polygon or set of points acceptably fits a plane.</span> <a name="l00259"></a>00259 <span class="comment"> * \sa TPolygon3D,geometryEpsilon</span> <a name="l00260"></a>00260 <span class="comment"> */</span> <a name="l00261"></a>00261 <span class="keywordtype">bool</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#ga4368cd73dd158c3263fb838453513c6e" title="Checks whether this polygon or set of points acceptably fits a plane.">conformAPlane</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points);<span class="comment"></span> <a name="l00262"></a>00262 <span class="comment"> /**</span> <a name="l00263"></a>00263 <span class="comment"> * Checks whether this polygon or set of points acceptably fits a plane, and if it's the case returns it in the second argument.</span> <a name="l00264"></a>00264 <span class="comment"> * \sa TPolygon3D,geometryEpsilon</span> <a name="l00265"></a>00265 <span class="comment"> */</span> <a name="l00266"></a>00266 <span class="keywordtype">bool</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#ga4368cd73dd158c3263fb838453513c6e" title="Checks whether this polygon or set of points acceptably fits a plane.">conformAPlane</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points,TPlane &p);<span class="comment"></span> <a name="l00267"></a>00267 <span class="comment"> /**</span> <a name="l00268"></a>00268 <span class="comment"> * Checks whether this set of points acceptably fits a 2D line.</span> <a name="l00269"></a>00269 <span class="comment"> * \sa geometryEpsilon</span> <a name="l00270"></a>00270 <span class="comment"> */</span> <a name="l00271"></a>00271 <span class="keywordtype">bool</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#ga0ff9066099dc3cb3bf0b0cdc75b87b8a" title="Checks whether this set of points acceptably fits a 2D line.">areAligned</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &points);<span class="comment"></span> <a name="l00272"></a>00272 <span class="comment"> /**</span> <a name="l00273"></a>00273 <span class="comment"> * Checks whether this set of points acceptably fits a 2D line, and if it's the case returns it in the second argument.</span> <a name="l00274"></a>00274 <span class="comment"> * \sa geometryEpsilon</span> <a name="l00275"></a>00275 <span class="comment"> */</span> <a name="l00276"></a>00276 <span class="keywordtype">bool</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#ga0ff9066099dc3cb3bf0b0cdc75b87b8a" title="Checks whether this set of points acceptably fits a 2D line.">areAligned</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &points,TLine2D &r);<span class="comment"></span> <a name="l00277"></a>00277 <span class="comment"> /**</span> <a name="l00278"></a>00278 <span class="comment"> * Checks whether this set of points acceptably fits a 3D line.</span> <a name="l00279"></a>00279 <span class="comment"> * \sa geometryEpsilon</span> <a name="l00280"></a>00280 <span class="comment"> */</span> <a name="l00281"></a>00281 <span class="keywordtype">bool</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#ga0ff9066099dc3cb3bf0b0cdc75b87b8a" title="Checks whether this set of points acceptably fits a 2D line.">areAligned</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points);<span class="comment"></span> <a name="l00282"></a>00282 <span class="comment"> /**</span> <a name="l00283"></a>00283 <span class="comment"> * Checks whether this set of points acceptably fits a 3D line, and if it's the case returns it in the second argument.</span> <a name="l00284"></a>00284 <span class="comment"> */</span> <a name="l00285"></a>00285 <span class="keywordtype">bool</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#ga0ff9066099dc3cb3bf0b0cdc75b87b8a" title="Checks whether this set of points acceptably fits a 2D line.">areAligned</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r);<span class="comment"></span> <a name="l00286"></a>00286 <span class="comment"> /** @}</span> <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"> /** @name Projections</span> <a name="l00290"></a>00290 <span class="comment"> @{</span> <a name="l00291"></a>00291 <span class="comment"> */</span><span class="comment"></span> <a name="l00292"></a>00292 <span class="comment"> /**</span> <a name="l00293"></a>00293 <span class="comment"> * Uses the given pose 3D to project a point into a new base.</span> <a name="l00294"></a>00294 <span class="comment"> */</span> <a name="l00295"></a><a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac">00295</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</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> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">TPoint3D</a> &newPoint) { <a name="l00296"></a>00296 newXYpose.<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html#aaabe44aa147e5391009051b49a6d524e" title="An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...">composePoint</a>(point.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>,point.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>,point.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>,newPoint.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>,newPoint.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>,newPoint.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <a name="l00297"></a>00297 }<span class="comment"></span> <a name="l00298"></a>00298 <span class="comment"> /**</span> <a name="l00299"></a>00299 <span class="comment"> * Uses the given pose 3D to project a segment into a new base.</span> <a name="l00300"></a>00300 <span class="comment"> */</span> <a name="l00301"></a><a class="code" href="group__geometry__grp.html#gafa9a1277ee17ec0beacdab848984ed29">00301</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</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 class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &newSegment) { <a name="l00302"></a>00302 <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>,newXYpose,newSegment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a5518ed3918d09ea1e48436f7fe41959a" title="Origin point.">point1</a>); <a name="l00303"></a>00303 <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>,newXYpose,newSegment.<a class="code" href="structmrpt_1_1math_1_1_t_segment3_d.html#a7e9d0f76a8d1148176a502641e235c79" title="Destiny point.">point2</a>); <a name="l00304"></a>00304 }<span class="comment"></span> <a name="l00305"></a>00305 <span class="comment"> /**</span> <a name="l00306"></a>00306 <span class="comment"> * Uses the given pose 3D to project a line into a new base.</span> <a name="l00307"></a>00307 <span class="comment"> */</span> <a name="l00308"></a>00308 <span class="keywordtype">void</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#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &line,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &newLine);<span class="comment"></span> <a name="l00309"></a>00309 <span class="comment"> /**</span> <a name="l00310"></a>00310 <span class="comment"> * Uses the given pose 3D to project a plane into a new base.</span> <a name="l00311"></a>00311 <span class="comment"> */</span> <a name="l00312"></a>00312 <span class="keywordtype">void</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#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> TPlane &plane,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,TPlane &newPlane);<span class="comment"></span> <a name="l00313"></a>00313 <span class="comment"> /**</span> <a name="l00314"></a>00314 <span class="comment"> * Uses the given pose 3D to project a polygon into a new base.</span> <a name="l00315"></a>00315 <span class="comment"> */</span> <a name="l00316"></a>00316 <span class="keywordtype">void</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#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &polygon,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,<a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &newPolygon);<span class="comment"></span> <a name="l00317"></a>00317 <span class="comment"> /**</span> <a name="l00318"></a>00318 <span class="comment"> * Uses the given pose 3D to project any 3D object into a new base.</span> <a name="l00319"></a>00319 <span class="comment"> */</span> <a name="l00320"></a>00320 <span class="keywordtype">void</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#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &<span class="keywordtype">object</span>,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYPose,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &newObject); <a name="l00321"></a>00321 <span class="comment"></span> <a name="l00322"></a>00322 <span class="comment"> /**</span> <a name="l00323"></a>00323 <span class="comment"> * Projects any 3D object into the plane's base, using its inverse pose. If the object is exactly inside the plane, this projection will zero its Z coordinates.</span> <a name="l00324"></a>00324 <span class="comment"> */</span> <a name="l00325"></a><a class="code" href="group__geometry__grp.html#ga3a8703f7747d7d472704621ea44c7021">00325</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> T &obj,<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> &newXYPlane,T &newObj) { <a name="l00326"></a>00326 <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> pose; <a name="l00327"></a>00327 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a>(newXYPlane).<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>(pose); <a name="l00328"></a>00328 <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(obj,-pose,newObj); <a name="l00329"></a>00329 } <a name="l00330"></a>00330 <span class="comment"></span> <a name="l00331"></a>00331 <span class="comment"> /**</span> <a name="l00332"></a>00332 <span class="comment"> * Projects any 3D object into the plane's base, using its inverse pose and forcing the position of the new coordinates origin. If the object is exactly inside the plane, this projection will zero its Z coordinates.</span> <a name="l00333"></a>00333 <span class="comment"> */</span> <a name="l00334"></a><a class="code" href="group__geometry__grp.html#gaa777931620bc326748391967ef724568">00334</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> T &obj,<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> &newXYPlane,<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,T &newObj) { <a name="l00335"></a>00335 <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> pose; <a name="l00336"></a>00336 <span class="comment">//TPlane(newXYPlane).getAsPose3DForcingOrigin(newOrigin,pose);</span> <a name="l00337"></a>00337 <a class="code" href="structmrpt_1_1math_1_1_t_plane.html" title="3D Plane, represented by its equation ">TPlane</a>(newXYPlane).<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>(pose); <a name="l00338"></a>00338 <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(obj,-pose,newObj); <a name="l00339"></a>00339 } <a name="l00340"></a>00340 <span class="comment"></span> <a name="l00341"></a>00341 <span class="comment"> /**</span> <a name="l00342"></a>00342 <span class="comment"> * Projects a set of 3D objects into the plane's base.</span> <a name="l00343"></a>00343 <span class="comment"> */</span> <a name="l00344"></a><a class="code" href="group__geometry__grp.html#gaa9f2fbd99fc5b7aa02f8ca7291e8dd18">00344</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &objs,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &newXYpose,<a class="code" href="classstd_1_1vector.html">std::vector<T></a> &newObjs) { <a name="l00345"></a>00345 <span class="keywordtype">size_t</span> N=objs.size(); <a name="l00346"></a>00346 newObjs.resize(N); <a name="l00347"></a>00347 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<N;i++) <a class="code" href="group__geometry__grp.html#gabc1ba0f4ffbfb1070b19923471fbd5ac" title="Uses the given pose 3D to project a point into a new base.">project3D</a>(objs[i],newXYpose,newObjs[i]); <a name="l00348"></a>00348 } <a name="l00349"></a>00349 <span class="comment"></span> <a name="l00350"></a>00350 <span class="comment"> /**</span> <a name="l00351"></a>00351 <span class="comment"> * Uses the given pose 2D to project a point into a new base.</span> <a name="l00352"></a>00352 <span class="comment"> */</span> <a name="l00353"></a><a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339">00353</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</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> <a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">CPose2D</a> &newXpose,<a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &newPoint) { <a name="l00354"></a>00354 newPoint=newXpose+<a class="code" href="classmrpt_1_1poses_1_1_c_point2_d.html" title="A class used to store a 2D point.">CPoint2D</a>(point); <a name="l00355"></a>00355 }<span class="comment"></span> <a name="l00356"></a>00356 <span class="comment"> /**</span> <a name="l00357"></a>00357 <span class="comment"> * Uses the given pose 2D to project a segment into a new base.</span> <a name="l00358"></a>00358 <span class="comment"> */</span> <a name="l00359"></a><a class="code" href="group__geometry__grp.html#gaea53914830f34b117463dee1594a1d9f">00359</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</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> &segment,<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.">CPose2D</a> &newXpose,<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &newSegment) { <a name="l00360"></a>00360 <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>,newXpose,newSegment.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#ac147784340e36d84e8148b4e371f022b" title="Origin point.">point1</a>); <a name="l00361"></a>00361 <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(segment.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>,newXpose,newSegment.<a class="code" href="structmrpt_1_1math_1_1_t_segment2_d.html#a312025aeea370854b76159d8526e1b91" title="Destiny point.">point2</a>); <a name="l00362"></a>00362 } <a name="l00363"></a>00363 <span class="comment"></span> <a name="l00364"></a>00364 <span class="comment"> /**</span> <a name="l00365"></a>00365 <span class="comment"> * Uses the given pose 2D to project a line into a new base.</span> <a name="l00366"></a>00366 <span class="comment"> */</span> <a name="l00367"></a>00367 <span class="keywordtype">void</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#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> TLine2D &line,<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.">CPose2D</a> &newXpose,TLine2D &newLine);<span class="comment"></span> <a name="l00368"></a>00368 <span class="comment"> /**</span> <a name="l00369"></a>00369 <span class="comment"> * Uses the given pose 2D to project a polygon into a new base.</span> <a name="l00370"></a>00370 <span class="comment"> */</span> <a name="l00371"></a>00371 <span class="keywordtype">void</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#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> TPolygon2D &polygon,<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.">CPose2D</a> &newXpose,TPolygon2D &newPolygon);<span class="comment"></span> <a name="l00372"></a>00372 <span class="comment"> /**</span> <a name="l00373"></a>00373 <span class="comment"> * Uses the given pose 2D to project any 2D object into a new base.</span> <a name="l00374"></a>00374 <span class="comment"> */</span> <a name="l00375"></a>00375 <span class="keywordtype">void</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#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> TObject2D &<span class="keywordtype">object</span>,<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.">CPose2D</a> &newXpose,TObject2D &newObject); <a name="l00376"></a>00376 <span class="comment"></span> <a name="l00377"></a>00377 <span class="comment"> /**</span> <a name="l00378"></a>00378 <span class="comment"> * Projects any 2D object into the line's base, using its inverse pose. If the object is exactly inside the line, this projection will zero its Y coordinate.</span> <a name="l00379"></a>00379 <span class="comment"> */</span> <a name="l00380"></a><a class="code" href="group__geometry__grp.html#ga4fc38e90d8d9d8d13db114369d4f6e6b">00380</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> T &obj,<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> &newXLine,T &newObj) { <a name="l00381"></a>00381 <a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">CPose2D</a> pose; <a name="l00382"></a>00382 newXLine.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a767eb25907e3bbfc9d61fad6f6406ac5" title="Get a pose2D whose X axis corresponds to the line.">getAsPose2D</a>(pose); <a name="l00383"></a>00383 <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(obj,<a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">CPose2D</a>(0,0,0)-pose,newObj); <a name="l00384"></a>00384 } <a name="l00385"></a>00385 <span class="comment"></span> <a name="l00386"></a>00386 <span class="comment"> /**</span> <a name="l00387"></a>00387 <span class="comment"> * Projects any 2D object into the line's base, using its inverse pose and forcing the position of the new coordinate origin. If the object is exactly inside the line, this projection will zero its Y coordinate.</span> <a name="l00388"></a>00388 <span class="comment"> */</span> <a name="l00389"></a><a class="code" href="group__geometry__grp.html#ga25fd57667837bb516e82539d86802f8b">00389</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> T &obj,<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> &newXLine,<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point2_d.html" title="Lightweight 2D point.">TPoint2D</a> &newOrigin,T &newObj) { <a name="l00390"></a>00390 <a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">CPose2D</a> pose; <a name="l00391"></a>00391 newXLine.<a class="code" href="structmrpt_1_1math_1_1_t_line2_d.html#a7b269f5d3576790080d75674d2aaa75e" title="Get a pose2D whose X axis corresponds to the line, forcing the base point to one given.">getAsPose2DForcingOrigin</a>(newOrigin,pose); <a name="l00392"></a>00392 <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(obj,<a class="code" href="classmrpt_1_1poses_1_1_c_pose2_d.html" title="A class used to store a 2D pose.">CPose2D</a>(0,0,0)-pose,newObj); <a name="l00393"></a>00393 } <a name="l00394"></a>00394 <span class="comment"></span> <a name="l00395"></a>00395 <span class="comment"> /**</span> <a name="l00396"></a>00396 <span class="comment"> * Projects a set of 2D objects into the line's base.</span> <a name="l00397"></a>00397 <span class="comment"> */</span> <a name="l00398"></a><a class="code" href="group__geometry__grp.html#gac1bbf25c63766b9ca0ed82167bf7961a">00398</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &objs,<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.">CPose2D</a> &newXpose,<a class="code" href="classstd_1_1vector.html">std::vector<T></a> &newObjs) { <a name="l00399"></a>00399 <span class="keywordtype">size_t</span> N=objs.size(); <a name="l00400"></a>00400 newObjs.resize(N); <a name="l00401"></a>00401 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<N;i++) <a class="code" href="group__geometry__grp.html#ga01a5878f7437f17ed3603a31e6190339" title="Uses the given pose 2D to project a point into a new base.">project2D</a>(objs[i],newXpose,newObjs[i]); <a name="l00402"></a>00402 }<span class="comment"></span> <a name="l00403"></a>00403 <span class="comment"> /** @}</span> <a name="l00404"></a>00404 <span class="comment"> */</span> <a name="l00405"></a>00405 <span class="comment"></span> <a name="l00406"></a>00406 <span class="comment"> /** @name Polygon intersections. These operations rely more on spatial reasoning than in raw numerical operations.</span> <a name="l00407"></a>00407 <span class="comment"> @{</span> <a name="l00408"></a>00408 <span class="comment"> */</span><span class="comment"></span> <a name="l00409"></a>00409 <span class="comment"> /**</span> <a name="l00410"></a>00410 <span class="comment"> * Gets the intersection between a 2D polygon and a 2D segment.</span> <a name="l00411"></a>00411 <span class="comment"> * \sa TObject2D</span> <a name="l00412"></a>00412 <span class="comment"> */</span> <a name="l00413"></a>00413 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TSegment2D &s2,TObject2D &obj);<span class="comment"></span> <a name="l00414"></a>00414 <span class="comment"> /**</span> <a name="l00415"></a>00415 <span class="comment"> * Gets the intersection between a 2D polygon and a 2D line.</span> <a name="l00416"></a>00416 <span class="comment"> * \sa TObject2D</span> <a name="l00417"></a>00417 <span class="comment"> */</span> <a name="l00418"></a>00418 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TLine2D &r2,TObject2D &obj);<span class="comment"></span> <a name="l00419"></a>00419 <span class="comment"> /**</span> <a name="l00420"></a>00420 <span class="comment"> * Gets the intersection between two 2D polygons.</span> <a name="l00421"></a>00421 <span class="comment"> * \sa TObject2D</span> <a name="l00422"></a>00422 <span class="comment"> */</span> <a name="l00423"></a>00423 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TPolygon2D &p2,TObject2D &obj);<span class="comment"></span> <a name="l00424"></a>00424 <span class="comment"> /**</span> <a name="l00425"></a>00425 <span class="comment"> * Gets the intersection between a 2D segment and a 2D polygon.</span> <a name="l00426"></a>00426 <span class="comment"> * \sa TObject2D</span> <a name="l00427"></a>00427 <span class="comment"> */</span> <a name="l00428"></a><a class="code" href="group__geometry__grp.html#ga5f241d690d1dc369584ab9894e1403aa">00428</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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="classmrpt_1_1math_1_1_t_polygon2_d.html" title="2D polygon, inheriting from std::vector<TPoint2D>.">TPolygon2D</a> &p2,<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="l00429"></a>00429 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,s1,obj); <a name="l00430"></a>00430 }<span class="comment"></span> <a name="l00431"></a>00431 <span class="comment"> /**</span> <a name="l00432"></a>00432 <span class="comment"> * Gets the intersection between a 2D line and a 2D polygon.</span> <a name="l00433"></a>00433 <span class="comment"> * \sa TObject2D</span> <a name="l00434"></a>00434 <span class="comment"> */</span> <a name="l00435"></a><a class="code" href="group__geometry__grp.html#ga498ab42b7016f46dfd864e6603983e79">00435</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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> &r1,<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> &p2,<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="l00436"></a>00436 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,r1,obj); <a name="l00437"></a>00437 }<span class="comment"></span> <a name="l00438"></a>00438 <span class="comment"> /**</span> <a name="l00439"></a>00439 <span class="comment"> * Gets the intersection between a 3D polygon and a 3D segment.</span> <a name="l00440"></a>00440 <span class="comment"> * \sa TObject3D</span> <a name="l00441"></a>00441 <span class="comment"> */</span> <a name="l00442"></a>00442 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00443"></a>00443 <span class="comment"> /**</span> <a name="l00444"></a>00444 <span class="comment"> * Gets the intersection between a 3D polygon and a 3D line.</span> <a name="l00445"></a>00445 <span class="comment"> * \sa TObject3D</span> <a name="l00446"></a>00446 <span class="comment"> */</span> <a name="l00447"></a>00447 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00448"></a>00448 <span class="comment"> /**</span> <a name="l00449"></a>00449 <span class="comment"> * Gets the intersection between a 3D polygon and a plane.</span> <a name="l00450"></a>00450 <span class="comment"> * \sa TObject3D</span> <a name="l00451"></a>00451 <span class="comment"> */</span> <a name="l00452"></a>00452 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> TPlane &p2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00453"></a>00453 <span class="comment"> /**</span> <a name="l00454"></a>00454 <span class="comment"> * Gets the intersection between two 3D polygons.</span> <a name="l00455"></a>00455 <span class="comment"> * \sa TObject3D</span> <a name="l00456"></a>00456 <span class="comment"> */</span> <a name="l00457"></a>00457 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00458"></a>00458 <span class="comment"> /**</span> <a name="l00459"></a>00459 <span class="comment"> * Gets the intersection between a 3D segment and a 3D polygon.</span> <a name="l00460"></a>00460 <span class="comment"> * \sa TObject3D</span> <a name="l00461"></a>00461 <span class="comment"> */</span> <a name="l00462"></a><a class="code" href="group__geometry__grp.html#gae54fcad3a2754529817b16dbd387a6e2">00462</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p2,<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="l00463"></a>00463 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,s1,obj); <a name="l00464"></a>00464 }<span class="comment"></span> <a name="l00465"></a>00465 <span class="comment"> /**</span> <a name="l00466"></a>00466 <span class="comment"> * Gets the intersection between a 3D line and a 3D polygon.</span> <a name="l00467"></a>00467 <span class="comment"> * \sa TObject3D</span> <a name="l00468"></a>00468 <span class="comment"> */</span> <a name="l00469"></a><a class="code" href="group__geometry__grp.html#gaa2686f4f203380a19184ee8bcfa5db35">00469</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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="classmrpt_1_1math_1_1_t_polygon3_d.html" title="3D polygon, inheriting from std::vector<TPoint3D>">TPolygon3D</a> &p2,<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="l00470"></a>00470 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,r1,obj); <a name="l00471"></a>00471 }<span class="comment"></span> <a name="l00472"></a>00472 <span class="comment"> /**</span> <a name="l00473"></a>00473 <span class="comment"> * Gets the intersection between a plane and a 3D polygon.</span> <a name="l00474"></a>00474 <span class="comment"> * \sa TObject3D</span> <a name="l00475"></a>00475 <span class="comment"> */</span> <a name="l00476"></a><a class="code" href="group__geometry__grp.html#gac0867b77fa033682044a131e1872ed3c">00476</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</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> &p1,<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> &p2,<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="l00477"></a>00477 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(p2,p1,obj); <a name="l00478"></a>00478 } <a name="l00479"></a>00479 <span class="comment"></span> <a name="l00480"></a>00480 <span class="comment"> /**</span> <a name="l00481"></a>00481 <span class="comment"> * Gets the intersection between two sets of 3D polygons. The intersection is returned as an sparse matrix with each pair of polygons' intersections, and the return value is the amount of intersections found.</span> <a name="l00482"></a>00482 <span class="comment"> * \sa TObject3D,CSparseMatrixTemplate</span> <a name="l00483"></a>00483 <span class="comment"> */</span> <a name="l00484"></a>00484 <span class="keywordtype">size_t</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &v1,<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &v2,CSparseMatrixTemplate<TObject3D> &objs);<span class="comment"></span> <a name="l00485"></a>00485 <span class="comment"> /**</span> <a name="l00486"></a>00486 <span class="comment"> * Gets the intersection between two sets of 3D polygons. The intersection is returned as a vector with every intersection found, and the return value is the amount of intersections found.</span> <a name="l00487"></a>00487 <span class="comment"> * \sa TObject3D</span> <a name="l00488"></a>00488 <span class="comment"> */</span> <a name="l00489"></a>00489 <span class="keywordtype">size_t</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &v1,<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &v2,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &objs);<span class="comment"></span> <a name="l00490"></a>00490 <span class="comment"> /** @}</span> <a name="l00491"></a>00491 <span class="comment"> */</span> <a name="l00492"></a>00492 <span class="comment"></span> <a name="l00493"></a>00493 <span class="comment"> /** @name Other intersections</span> <a name="l00494"></a>00494 <span class="comment"> @{</span> <a name="l00495"></a>00495 <span class="comment"> */</span><span class="comment"></span> <a name="l00496"></a>00496 <span class="comment"> /**</span> <a name="l00497"></a>00497 <span class="comment"> * Gets the intersection between vectors of geometric objects and returns it in a sparse matrix of either TObject2D or TObject3D.</span> <a name="l00498"></a>00498 <span class="comment"> * \sa TObject2D,TObject3D,CSparseMatrix</span> <a name="l00499"></a>00499 <span class="comment"> */</span> <a name="l00500"></a><a class="code" href="group__geometry__grp.html#gaa1f06d8e0612780e9a4adf91377e9cbc">00500</a> <span class="keyword">template</span><<span class="keyword">class</span> T,<span class="keyword">class</span> U,<span class="keyword">class</span> O> <span class="keywordtype">size_t</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &v1,<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<U></a> &v2,<a class="code" href="classmrpt_1_1math_1_1_c_sparse_matrix_template.html" title="A sparse matrix container (with cells of any type), with iterators.">CSparseMatrixTemplate<O></a> &objs) { <a name="l00501"></a>00501 <span class="keywordtype">size_t</span> M=v1.size(),N=v2.size(); <a name="l00502"></a>00502 O obj; <a name="l00503"></a>00503 objs.<a class="code" href="classmrpt_1_1math_1_1_c_sparse_matrix_template.html#a731b30d399c81cc6261bcca28ed60b7f" title="Completely removes all elements, although maintaining the matrix's size.">clear</a>(); <a name="l00504"></a>00504 objs.<a class="code" href="classmrpt_1_1math_1_1_c_sparse_matrix_template.html#a5082b1f2bb5aec9b1f8b7ce5371bc7c3" title="Changes the size of the matrix.">resize</a>(M,N); <a name="l00505"></a>00505 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0;i<M;i++) <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j=0;j<M;j++) <span class="keywordflow">if</span> (<a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(v1[i],v2[j],obj)) objs(i,j)=obj; <a name="l00506"></a>00506 <span class="keywordflow">return</span> objs.<a class="code" href="classmrpt_1_1math_1_1_c_sparse_matrix_template.html#a5d0fa6333648b6433ebd9b62172c968b" title="Gets the amount of non-null elements inside the matrix.">getNonNullElements</a>(); <a name="l00507"></a>00507 } <a name="l00508"></a>00508 <span class="comment"></span> <a name="l00509"></a>00509 <span class="comment"> /**</span> <a name="l00510"></a>00510 <span class="comment"> * Gets the intersection between vectors of geometric objects and returns it in a vector of either TObject2D or TObject3D.</span> <a name="l00511"></a>00511 <span class="comment"> * \sa TObject2D,TObject3D</span> <a name="l00512"></a>00512 <span class="comment"> */</span> <a name="l00513"></a><a class="code" href="group__geometry__grp.html#ga8c9938ba7a1666b258ad3d487df9af68">00513</a> <span class="keyword">template</span><<span class="keyword">class</span> T,<span class="keyword">class</span> U,<span class="keyword">class</span> O> <span class="keywordtype">size_t</span> <a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &v1,<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<U></a> &v2,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<O></a> objs) { <a name="l00514"></a>00514 objs.resize(0); <a name="l00515"></a>00515 O obj; <a name="l00516"></a>00516 <span class="keywordflow">for</span> (<span class="keyword">typename</span> <a class="code" href="classstd_1_1vector_1_1const__iterator.html" title="STL iterator class.">std::vector<T>::const_iterator</a> it1=v1.begin();it1!=v1.end();it1++) { <a name="l00517"></a>00517 <span class="keyword">const</span> T &elem1=*it1; <a name="l00518"></a>00518 <span class="keywordflow">for</span> (<span class="keyword">typename</span> <a class="code" href="classstd_1_1vector_1_1const__iterator.html" title="STL iterator class.">std::vector<U>::const_iterator</a> it2=v2.begin();it2!=v2.end();it2++) <span class="keywordflow">if</span> (<a class="code" href="group__geometry__grp.html#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(elem1,*it2,obj)) objs.push_back(obj); <a name="l00519"></a>00519 } <a name="l00520"></a>00520 <span class="keywordflow">return</span> objs.size(); <a name="l00521"></a>00521 } <a name="l00522"></a>00522 <span class="comment"></span> <a name="l00523"></a>00523 <span class="comment"> /**</span> <a name="l00524"></a>00524 <span class="comment"> * Gets the intersection between any pair of 2D objects.</span> <a name="l00525"></a>00525 <span class="comment"> */</span> <a name="l00526"></a>00526 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> TObject2D &o1,<span class="keyword">const</span> TObject2D &o2,TObject2D &obj);<span class="comment"></span> <a name="l00527"></a>00527 <span class="comment"> /**</span> <a name="l00528"></a>00528 <span class="comment"> * Gets the intersection between any pair of 3D objects.</span> <a name="l00529"></a>00529 <span class="comment"> */</span> <a name="l00530"></a>00530 <span class="keywordtype">bool</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#ga096194319b696aecf5ab9337a2f60c44" title="Gets the intersection between two 3D segments.">intersect</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &o1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &o2,<a class="code" href="group__geometry__grp.html#ga621fd9d87c2da1ad022a4192779adfef">TObject3D</a> &obj);<span class="comment"></span> <a name="l00531"></a>00531 <span class="comment"> /** @}</span> <a name="l00532"></a>00532 <span class="comment"> */</span> <a name="l00533"></a>00533 <span class="comment"></span> <a name="l00534"></a>00534 <span class="comment"> /** @name Distances</span> <a name="l00535"></a>00535 <span class="comment"> @{</span> <a name="l00536"></a>00536 <span class="comment"> */</span><span class="comment"></span> <a name="l00537"></a>00537 <span class="comment"> /**</span> <a name="l00538"></a>00538 <span class="comment"> * Gets the distance between two points in a 2D space.</span> <a name="l00539"></a>00539 <span class="comment"> */</span> <a name="l00540"></a>00540 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPoint2D &p1,<span class="keyword">const</span> TPoint2D &p2);<span class="comment"></span> <a name="l00541"></a>00541 <span class="comment"> /**</span> <a name="l00542"></a>00542 <span class="comment"> * Gets the distance between two points in a 3D space.</span> <a name="l00543"></a>00543 <span class="comment"> */</span> <a name="l00544"></a>00544 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPoint3D &p1,<span class="keyword">const</span> TPoint3D &p2);<span class="comment"></span> <a name="l00545"></a>00545 <span class="comment"> /**</span> <a name="l00546"></a>00546 <span class="comment"> * Gets the distance between two lines in a 2D space.</span> <a name="l00547"></a>00547 <span class="comment"> */</span> <a name="l00548"></a>00548 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TLine2D &r1,<span class="keyword">const</span> TLine2D &r2);<span class="comment"></span> <a name="l00549"></a>00549 <span class="comment"> /**</span> <a name="l00550"></a>00550 <span class="comment"> * Gets the distance between two lines in a 3D space.</span> <a name="l00551"></a>00551 <span class="comment"> */</span> <a name="l00552"></a>00552 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &r2);<span class="comment"></span> <a name="l00553"></a>00553 <span class="comment"> /**</span> <a name="l00554"></a>00554 <span class="comment"> * Gets the distance between two planes. It will be zero if the planes are not parallel.</span> <a name="l00555"></a>00555 <span class="comment"> */</span> <a name="l00556"></a>00556 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPlane &p1,<span class="keyword">const</span> TPlane &p2); <a name="l00557"></a>00557 <span class="comment"></span> <a name="l00558"></a>00558 <span class="comment"> /**</span> <a name="l00559"></a>00559 <span class="comment"> * Gets the distance between two polygons in a 2D space.</span> <a name="l00560"></a>00560 <span class="comment"> */</span> <a name="l00561"></a>00561 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TPolygon2D &p2);<span class="comment"></span> <a name="l00562"></a>00562 <span class="comment"> /**</span> <a name="l00563"></a>00563 <span class="comment"> * Gets the distance between a polygon and a segment in a 2D space.</span> <a name="l00564"></a>00564 <span class="comment"> */</span> <a name="l00565"></a>00565 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TSegment2D &s2);<span class="comment"></span> <a name="l00566"></a>00566 <span class="comment"> /**</span> <a name="l00567"></a>00567 <span class="comment"> * Gets the distance between a segment and a polygon in a 2D space.</span> <a name="l00568"></a>00568 <span class="comment"> */</span> <a name="l00569"></a><a class="code" href="group__geometry__grp.html#gae4801fe47285acad2533585a42eac9cd">00569</a> <span class="keyword">inline</span> <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_segment2_d.html" title="2D segment, consisting of two points.">TSegment2D</a> &s1,<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> &p2) { <a name="l00570"></a>00570 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(p2,s1); <a name="l00571"></a>00571 }<span class="comment"></span> <a name="l00572"></a>00572 <span class="comment"> /**</span> <a name="l00573"></a>00573 <span class="comment"> * Gets the distance between a polygon and a line in a 2D space.</span> <a name="l00574"></a>00574 <span class="comment"> */</span> <a name="l00575"></a>00575 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> TPolygon2D &p1,<span class="keyword">const</span> TLine2D &l2); <a name="l00576"></a><a class="code" href="group__geometry__grp.html#ga199640d96dc07d84a787660b07059b06">00576</a> <span class="keyword">inline</span> <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_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a> &l1,<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> &p2) { <a name="l00577"></a>00577 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(p2,l1); <a name="l00578"></a>00578 }<span class="comment"></span> <a name="l00579"></a>00579 <span class="comment"> /**</span> <a name="l00580"></a>00580 <span class="comment"> * Gets the distance between two polygons in a 3D space.</span> <a name="l00581"></a>00581 <span class="comment"> */</span> <a name="l00582"></a>00582 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p2);<span class="comment"></span> <a name="l00583"></a>00583 <span class="comment"> /**</span> <a name="l00584"></a>00584 <span class="comment"> * Gets the distance between a polygon and a segment in a 3D space.</span> <a name="l00585"></a>00585 <span class="comment"> */</span> <a name="l00586"></a>00586 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &s2);<span class="comment"></span> <a name="l00587"></a>00587 <span class="comment"> /**</span> <a name="l00588"></a>00588 <span class="comment"> * Gets the distance between a segment and a polygon in a 3D space.</span> <a name="l00589"></a>00589 <span class="comment"> */</span> <a name="l00590"></a><a class="code" href="group__geometry__grp.html#ga19a574fbbb884252278e69af2d4f64eb">00590</a> <span class="keyword">inline</span> <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_segment3_d.html" title="3D segment, consisting of two points.">TSegment3D</a> &s1,<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> &p2) { <a name="l00591"></a>00591 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(p2,s1); <a name="l00592"></a>00592 }<span class="comment"></span> <a name="l00593"></a>00593 <span class="comment"> /**</span> <a name="l00594"></a>00594 <span class="comment"> * Gets the distance between a polygon and a line in a 3D space.</span> <a name="l00595"></a>00595 <span class="comment"> */</span> <a name="l00596"></a>00596 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &p1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &l2);<span class="comment"></span> <a name="l00597"></a>00597 <span class="comment"> /**</span> <a name="l00598"></a>00598 <span class="comment"> * Gets the distance between a line and a polygon in a 3D space.</span> <a name="l00599"></a>00599 <span class="comment"> */</span> <a name="l00600"></a><a class="code" href="group__geometry__grp.html#ga50cc3a8b2fdca23879e8a2c8d3473199">00600</a> <span class="keyword">inline</span> <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> &l1,<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> &p2) { <a name="l00601"></a>00601 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(p2,l1); <a name="l00602"></a>00602 }<span class="comment"></span> <a name="l00603"></a>00603 <span class="comment"> /**</span> <a name="l00604"></a>00604 <span class="comment"> * Gets the distance between a polygon and a plane.</span> <a name="l00605"></a>00605 <span class="comment"> */</span> <a name="l00606"></a>00606 <span class="keywordtype">double</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#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &po,<span class="keyword">const</span> TPlane &pl);<span class="comment"></span> <a name="l00607"></a>00607 <span class="comment"> /**</span> <a name="l00608"></a>00608 <span class="comment"> * Gets the distance between a plane and a polygon.</span> <a name="l00609"></a>00609 <span class="comment"> */</span> <a name="l00610"></a><a class="code" href="group__geometry__grp.html#gabfb83bd00d767a1fa6c2f8f846577e23">00610</a> <span class="keyword">inline</span> <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_plane.html" title="3D Plane, represented by its equation ">TPlane</a> &pl,<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> &po) { <a name="l00611"></a>00611 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga8c0a76e906f12560cfa49fcd269c8398" title="Gets the distance between two points in a 2D space.">distance</a>(po,pl); <a name="l00612"></a>00612 }<span class="comment"></span> <a name="l00613"></a>00613 <span class="comment"> /** @}</span> <a name="l00614"></a>00614 <span class="comment"> */</span> <a name="l00615"></a>00615 <span class="comment"></span> <a name="l00616"></a>00616 <span class="comment"> /** @name Bound checkers</span> <a name="l00617"></a>00617 <span class="comment"> @{</span> <a name="l00618"></a>00618 <span class="comment"> */</span><span class="comment"></span> <a name="l00619"></a>00619 <span class="comment"> /**</span> <a name="l00620"></a>00620 <span class="comment"> * Gets the rectangular bounds of a 2D polygon or set of 2D points.</span> <a name="l00621"></a>00621 <span class="comment"> */</span> <a name="l00622"></a>00622 <span class="keywordtype">void</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#ga4f4ff8f3ab7f6d609beb2e9c602cbc28" title="Gets the rectangular bounds of a 2D polygon or set of 2D points.">getRectangleBounds</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &poly,TPoint2D &pMin,TPoint2D &pMax);<span class="comment"></span> <a name="l00623"></a>00623 <span class="comment"> /**</span> <a name="l00624"></a>00624 <span class="comment"> * Gets the prism bounds of a 3D polygon or set of 3D points.</span> <a name="l00625"></a>00625 <span class="comment"> */</span> <a name="l00626"></a>00626 <span class="keywordtype">void</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#ga772fe8216ba10a88dd6d4b261a53feaa" title="Gets the prism bounds of a 3D polygon or set of 3D points.">getPrismBounds</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &poly,TPoint3D &pMin,TPoint3D &pMax);<span class="comment"></span> <a name="l00627"></a>00627 <span class="comment"> /** @}</span> <a name="l00628"></a>00628 <span class="comment"> */</span> <a name="l00629"></a>00629 <span class="comment"></span> <a name="l00630"></a>00630 <span class="comment"> /** @name Creation of planes from poses</span> <a name="l00631"></a>00631 <span class="comment"> @{</span> <a name="l00632"></a>00632 <span class="comment"> */</span><span class="comment"></span> <a name="l00633"></a>00633 <span class="comment"> /**</span> <a name="l00634"></a>00634 <span class="comment"> * Given a pose, creates a plane orthogonal to its Z vector.</span> <a name="l00635"></a>00635 <span class="comment"> * \sa createPlaneFromPoseXZ,createPlaneFromPoseYZ,createPlaneFromPoseAndNormal</span> <a name="l00636"></a>00636 <span class="comment"> */</span> <a name="l00637"></a>00637 <span class="keywordtype">void</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#ga74bce932e6ae7f5a091bd36d75467519" title="Given a pose, creates a plane orthogonal to its Z vector.">createPlaneFromPoseXY</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &pose,TPlane &plane);<span class="comment"></span> <a name="l00638"></a>00638 <span class="comment"> /**</span> <a name="l00639"></a>00639 <span class="comment"> * Given a pose, creates a plane orthogonal to its Y vector.</span> <a name="l00640"></a>00640 <span class="comment"> * \sa createPlaneFromPoseXY,createPlaneFromPoseYZ,createPlaneFromPoseAndNormal</span> <a name="l00641"></a>00641 <span class="comment"> */</span> <a name="l00642"></a>00642 <span class="keywordtype">void</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#gaff7d84e9126688dd125d24b1fc031bb5" title="Given a pose, creates a plane orthogonal to its Y vector.">createPlaneFromPoseXZ</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &pose,TPlane &plane);<span class="comment"></span> <a name="l00643"></a>00643 <span class="comment"> /**</span> <a name="l00644"></a>00644 <span class="comment"> * Given a pose, creates a plane orthogonal to its X vector.</span> <a name="l00645"></a>00645 <span class="comment"> * \sa createPlaneFromPoseXY,createPlaneFromPoseXZ,createPlaneFromPoseAndNormal</span> <a name="l00646"></a>00646 <span class="comment"> */</span> <a name="l00647"></a>00647 <span class="keywordtype">void</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#ga593e98312e5c06b4c1080fe4a3b47242" title="Given a pose, creates a plane orthogonal to its X vector.">createPlaneFromPoseYZ</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &pose,TPlane &plane);<span class="comment"></span> <a name="l00648"></a>00648 <span class="comment"> /**</span> <a name="l00649"></a>00649 <span class="comment"> * Given a pose and any vector, creates a plane orthogonal to that vector in the pose's coordinates.</span> <a name="l00650"></a>00650 <span class="comment"> * \sa createPlaneFromPoseXY,createPlaneFromPoseXZ,createPlaneFromPoseYZ</span> <a name="l00651"></a>00651 <span class="comment"> */</span> <a name="l00652"></a>00652 <span class="keywordtype">void</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#ga362f34f935e4c160cbc394786b73a0b8" title="Given a pose and any vector, creates a plane orthogonal to that vector in the pose's coordinates...">createPlaneFromPoseAndNormal</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> &pose,<span class="keyword">const</span> <span class="keywordtype">double</span> (&normal)[3],TPlane &plane);<span class="comment"></span> <a name="l00653"></a>00653 <span class="comment"> /**</span> <a name="l00654"></a>00654 <span class="comment"> * Creates a rotation matrix so that the coordinate given (0 for x, 1 for y, 2 for z) corresponds to the vector.</span> <a name="l00655"></a>00655 <span class="comment"> */</span> <a name="l00656"></a>00656 <span class="keywordtype">void</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#ga1e345799e96a2fb5e84ac9f0df9230ef" title="Creates a rotation matrix so that the coordinate given (0 for x, 1 for y, 2 for z) corresponds to the...">generateAxisBaseFromDirectionAndAxis</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> (&vec)[3],<span class="keywordtype">char</span> coord,<a class="code" href="namespacemrpt_1_1math.html#a3814c2b868f059d6a7ab0d8ecd2311d6" title="Declares a matrix of double numbers (non serializable).">CMatrixDouble</a> &matrix);<span class="comment"></span> <a name="l00657"></a>00657 <span class="comment"> /** @}</span> <a name="l00658"></a>00658 <span class="comment"> */</span> <a name="l00659"></a>00659 <span class="comment"></span> <a name="l00660"></a>00660 <span class="comment"> /** @name Linear regression methods</span> <a name="l00661"></a>00661 <span class="comment"> @{</span> <a name="l00662"></a>00662 <span class="comment"> */</span><span class="comment"></span> <a name="l00663"></a>00663 <span class="comment"> /**</span> <a name="l00664"></a>00664 <span class="comment"> * Using eigenvalues, gets the best fitting line for a set of 2D points. Returns an estimation of the error.</span> <a name="l00665"></a>00665 <span class="comment"> * \sa spline, leastSquareLinearFit</span> <a name="l00666"></a>00666 <span class="comment"> */</span> <a name="l00667"></a>00667 <span class="keywordtype">double</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#ga7c40628072431c08a126bef3bb2b9a27" title="Using eigenvalues, gets the best fitting line for a set of 2D points.">getRegressionLine</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint2D></a> &points,TLine2D &line);<span class="comment"></span> <a name="l00668"></a>00668 <span class="comment"> /**</span> <a name="l00669"></a>00669 <span class="comment"> * Using eigenvalues, gets the best fitting line for a set of 3D points. Returns an estimation of the error.</span> <a name="l00670"></a>00670 <span class="comment"> * \sa spline, leastSquareLinearFit</span> <a name="l00671"></a>00671 <span class="comment"> */</span> <a name="l00672"></a>00672 <span class="keywordtype">double</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#ga7c40628072431c08a126bef3bb2b9a27" title="Using eigenvalues, gets the best fitting line for a set of 2D points.">getRegressionLine</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &line);<span class="comment"></span> <a name="l00673"></a>00673 <span class="comment"> /**</span> <a name="l00674"></a>00674 <span class="comment"> * Using eigenvalues, gets the best fitting plane for a set of 3D points. Returns an estimation of the error.</span> <a name="l00675"></a>00675 <span class="comment"> * \sa spline, leastSquareLinearFit</span> <a name="l00676"></a>00676 <span class="comment"> */</span> <a name="l00677"></a>00677 <span class="keywordtype">double</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#ga14d21b4e5b6277e7c0ea4f00b2eb2b3e" title="Using eigenvalues, gets the best fitting plane for a set of 3D points.">getRegressionPlane</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TPoint3D></a> &points,TPlane &plane);<span class="comment"></span> <a name="l00678"></a>00678 <span class="comment"> /** @}</span> <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"> /** @name Miscellaneous Geometry methods</span> <a name="l00682"></a>00682 <span class="comment"> @{</span> <a name="l00683"></a>00683 <span class="comment"> */</span><span class="comment"></span> <a name="l00684"></a>00684 <span class="comment"> /**</span> <a name="l00685"></a>00685 <span class="comment"> * Tries to assemble a set of segments into a set of closed polygons.</span> <a name="l00686"></a>00686 <span class="comment"> */</span> <a name="l00687"></a>00687 <span class="keywordtype">void</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#ga860ca5edc86af5e27d63153a8ceef98f" title="Tries to assemble a set of segments into a set of closed polygons.">assemblePolygons</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &segms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys);<span class="comment"></span> <a name="l00688"></a>00688 <span class="comment"> /**</span> <a name="l00689"></a>00689 <span class="comment"> * Tries to assemble a set of segments into a set of closed polygons, returning the unused segments as another out parameter.</span> <a name="l00690"></a>00690 <span class="comment"> */</span> <a name="l00691"></a>00691 <span class="keywordtype">void</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#ga860ca5edc86af5e27d63153a8ceef98f" title="Tries to assemble a set of segments into a set of closed polygons.">assemblePolygons</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &segms,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TPolygon3D></a> &polys,<a class="code" href="classstd_1_1vector.html">std::vector<TSegment3D></a> &remainder);<span class="comment"></span> <a name="l00692"></a>00692 <span class="comment"> /**</span> <a name="l00693"></a>00693 <span class="comment"> * Extracts all the polygons, including those formed from segments, from the set of objects.</span> <a name="l00694"></a>00694 <span class="comment"> */</span> <a name="l00695"></a>00695 <span class="keywordtype">void</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#ga860ca5edc86af5e27d63153a8ceef98f" title="Tries to assemble a set of segments into a set of closed polygons.">assemblePolygons</a>(<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="l00696"></a>00696 <span class="comment"> /**</span> <a name="l00697"></a>00697 <span class="comment"> * Extracts all the polygons, including those formed from segments, from the set of objects.</span> <a name="l00698"></a>00698 <span class="comment"> */</span> <a name="l00699"></a>00699 <span class="keywordtype">void</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#ga860ca5edc86af5e27d63153a8ceef98f" title="Tries to assemble a set of segments into a set of closed polygons.">assemblePolygons</a>(<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);<span class="comment"></span> <a name="l00700"></a>00700 <span class="comment"> /**</span> <a name="l00701"></a>00701 <span class="comment"> * Extracts all the polygons, including those formed from segments, from the set of objects.</span> <a name="l00702"></a>00702 <span class="comment"> */</span> <a name="l00703"></a>00703 <span class="keywordtype">void</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#ga860ca5edc86af5e27d63153a8ceef98f" title="Tries to assemble a set of segments into a set of closed polygons.">assemblePolygons</a>(<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">std::vector<TSegment3D></a> &remainder1,<a class="code" href="classstd_1_1vector.html" title="STL class.">std::vector<TObject3D></a> &remainder2); <a name="l00704"></a>00704 <span class="comment"></span> <a name="l00705"></a>00705 <span class="comment"> /**</span> <a name="l00706"></a>00706 <span class="comment"> * Changes the value of the geometric epsilon.</span> <a name="l00707"></a>00707 <span class="comment"> * \sa geometryEpsilon,getEpsilon</span> <a name="l00708"></a>00708 <span class="comment"> */</span> <a name="l00709"></a><a class="code" href="group__geometry__grp.html#ga6ee56196af1534bb1c408eb5fedbc64a">00709</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga6ee56196af1534bb1c408eb5fedbc64a" title="Changes the value of the geometric epsilon.">setEpsilon</a>(<span class="keywordtype">double</span> nE) { <a name="l00710"></a>00710 <a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>=nE; <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"> * Gets the value of the geometric epsilon.</span> <a name="l00714"></a>00714 <span class="comment"> * \sa geometryEpsilon,setEpsilon</span> <a name="l00715"></a>00715 <span class="comment"> */</span> <a name="l00716"></a><a class="code" href="group__geometry__grp.html#gac164dcd4d3f3b2a46fd098cae08bfc7f">00716</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__geometry__grp.html#gac164dcd4d3f3b2a46fd098cae08bfc7f" title="Gets the value of the geometric epsilon.">getEpsilon</a>() { <a name="l00717"></a>00717 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>; <a name="l00718"></a>00718 } <a name="l00719"></a>00719 <span class="comment"></span> <a name="l00720"></a>00720 <span class="comment"> /**</span> <a name="l00721"></a>00721 <span class="comment"> * Splits a 2D polygon into convex components.</span> <a name="l00722"></a>00722 <span class="comment"> */</span> <a name="l00723"></a>00723 <span class="keywordtype">bool</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#ga765a2078a3e24f5a172b14b0a5e8edcf" title="Splits a 2D polygon into convex components.">splitInConvexComponents</a>(<span class="keyword">const</span> TPolygon2D &poly,vector<TPolygon2D> &components);<span class="comment"></span> <a name="l00724"></a>00724 <span class="comment"> /**</span> <a name="l00725"></a>00725 <span class="comment"> * Splits a 3D polygon into convex components.</span> <a name="l00726"></a>00726 <span class="comment"> * \throw std::logic_error if the polygon can't be fit into a plane.</span> <a name="l00727"></a>00727 <span class="comment"> */</span> <a name="l00728"></a>00728 <span class="keywordtype">bool</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#ga765a2078a3e24f5a172b14b0a5e8edcf" title="Splits a 2D polygon into convex components.">splitInConvexComponents</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac96724117d963fde72380a079deaea23">TPolygon3D</a> &poly,vector<TPolygon3D> &components); <a name="l00729"></a>00729 <span class="comment"></span> <a name="l00730"></a>00730 <span class="comment"> /**</span> <a name="l00731"></a>00731 <span class="comment"> * Gets the bisector of a 2D segment.</span> <a name="l00732"></a>00732 <span class="comment"> */</span> <a name="l00733"></a>00733 <span class="keywordtype">void</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#gac104a1bc6eb508467389666e7cc20c2e" title="Gets the bisector of a 2D segment.">getSegmentBisector</a>(<span class="keyword">const</span> TSegment2D &sgm,TLine2D &bis);<span class="comment"></span> <a name="l00734"></a>00734 <span class="comment"> /**</span> <a name="l00735"></a>00735 <span class="comment"> * Gets the bisector of a 3D segment.</span> <a name="l00736"></a>00736 <span class="comment"> */</span> <a name="l00737"></a>00737 <span class="keywordtype">void</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#gac104a1bc6eb508467389666e7cc20c2e" title="Gets the bisector of a 2D segment.">getSegmentBisector</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#ga6062a8844f75e4a2efd63d7027237b5a">TSegment3D</a> &sgm,TPlane &bis);<span class="comment"></span> <a name="l00738"></a>00738 <span class="comment"> /**</span> <a name="l00739"></a>00739 <span class="comment"> * Gets the bisector of two lines or segments (implicit constructor will be used if necessary)</span> <a name="l00740"></a>00740 <span class="comment"> */</span> <a name="l00741"></a>00741 <span class="keywordtype">void</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#ga81505df2cba76f0399244d46096da571" title="Gets the bisector of two lines or segments (implicit constructor will be used if necessary)">getAngleBisector</a>(<span class="keyword">const</span> TLine2D &l1,<span class="keyword">const</span> TLine2D &l2,TLine2D &bis);<span class="comment"></span> <a name="l00742"></a>00742 <span class="comment"> /**</span> <a name="l00743"></a>00743 <span class="comment"> * Gets the bisector of two lines or segments (implicit constructor will be used if necessary)</span> <a name="l00744"></a>00744 <span class="comment"> * \throw std::logic_error if the lines do not fit in a single plane.</span> <a name="l00745"></a>00745 <span class="comment"> */</span> <a name="l00746"></a>00746 <span class="keywordtype">void</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#ga81505df2cba76f0399244d46096da571" title="Gets the bisector of two lines or segments (implicit constructor will be used if necessary)">getAngleBisector</a>(<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &l1,<span class="keyword">const</span> <a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &l2,<a class="code" href="group__geometry__grp.html#gac4f838c4ff28e24b60032903f9a87339">TLine3D</a> &bis); <a name="l00747"></a>00747 <span class="comment"></span> <a name="l00748"></a>00748 <span class="comment"> /**</span> <a name="l00749"></a>00749 <span class="comment"> * Fast ray tracing method using polygons' properties.</span> <a name="l00750"></a>00750 <span class="comment"> * \sa CRenderizable::rayTrace</span> <a name="l00751"></a>00751 <span class="comment"> */</span> <a name="l00752"></a>00752 <span class="keywordtype">bool</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#ga363e00600f9c000dd774e6c721faba7d" title="Fast ray tracing method using polygons' properties.">traceRay</a>(<span class="keyword">const</span> vector<TPolygonWithPlane> &vec,<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,<span class="keywordtype">double</span> &dist);<span class="comment"></span> <a name="l00753"></a>00753 <span class="comment"> /**</span> <a name="l00754"></a>00754 <span class="comment"> * Fast ray tracing method using polygons' properties.</span> <a name="l00755"></a>00755 <span class="comment"> * \sa CRenderizable::rayTrace</span> <a name="l00756"></a>00756 <span class="comment"> */</span> <a name="l00757"></a><a class="code" href="group__geometry__grp.html#gad3a55044d9f2abb347c7221e3e58d45e">00757</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga363e00600f9c000dd774e6c721faba7d" title="Fast ray tracing method using polygons' properties.">traceRay</a>(<span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html" title="STL class.">vector<TPolygon3D></a> &vec,<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,<span class="keywordtype">double</span> &dist) { <a name="l00758"></a>00758 <a class="code" href="classstd_1_1vector.html">vector<TPolygonWithPlane></a> pwp; <a name="l00759"></a>00759 <a class="code" href="classmrpt_1_1math_1_1_t_polygon_with_plane.html#a9f32edbe0deaeeac5cb84be188a792f8" title="Static method for vectors.">TPolygonWithPlane::getPlanes</a>(vec,pwp); <a name="l00760"></a>00760 <span class="keywordflow">return</span> <a class="code" href="group__geometry__grp.html#ga363e00600f9c000dd774e6c721faba7d" title="Fast ray tracing method using polygons' properties.">traceRay</a>(pwp,pose,dist); <a name="l00761"></a>00761 } <a name="l00762"></a>00762 <span class="comment"></span> <a name="l00763"></a>00763 <span class="comment"> /** Computes the cross product of two 3D vectors, returning a vector normal to both.</span> <a name="l00764"></a>00764 <span class="comment"> * It uses the simple implementation:</span> <a name="l00765"></a>00765 <span class="comment"></span> <a name="l00766"></a>00766 <span class="comment"> \f[ v_out = \left(</span> <a name="l00767"></a>00767 <span class="comment"> \begin{array}{c c c}</span> <a name="l00768"></a>00768 <span class="comment"> \hat{i} ~ \hat{j} ~ \hat{k} \\</span> <a name="l00769"></a>00769 <span class="comment"> x0 ~ y0 ~ z0 \\</span> <a name="l00770"></a>00770 <span class="comment"> x1 ~ y1 ~ z1 \\</span> <a name="l00771"></a>00771 <span class="comment"> \end{array} \right)</span> <a name="l00772"></a>00772 <span class="comment"> \f]</span> <a name="l00773"></a>00773 <span class="comment"> */</span> <a name="l00774"></a>00774 <span class="keyword">template</span><<span class="keyword">class</span> T,<span class="keyword">class</span> U,<span class="keyword">class</span> V> <a name="l00775"></a><a class="code" href="group__geometry__grp.html#gad8d6fbe91133eb0caa6722ae378ea3fb">00775</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gad8d6fbe91133eb0caa6722ae378ea3fb" title="Computes the cross product of two 3D vectors, returning a vector normal to both.">crossProduct3D</a>(<span class="keyword">const</span> T &v0,<span class="keyword">const</span> U &v1,V& vOut) { <a name="l00776"></a>00776 vOut[0]=v0[1]*v1[2]-v0[2]*v1[1]; <a name="l00777"></a>00777 vOut[1]=v0[2]*v1[0]-v0[0]*v1[2]; <a name="l00778"></a>00778 vOut[2]=v0[0]*v1[1]-v0[1]*v1[0]; <a name="l00779"></a>00779 } <a name="l00780"></a>00780 <span class="comment"></span> <a name="l00781"></a>00781 <span class="comment"> //! \overload</span> <a name="l00782"></a>00782 <span class="comment"></span> <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00783"></a><a class="code" href="group__geometry__grp.html#ga20dcc4f19cc9529611235c78937e1ea5">00783</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gad8d6fbe91133eb0caa6722ae378ea3fb" title="Computes the cross product of two 3D vectors, returning a vector normal to both.">crossProduct3D</a>( <a name="l00784"></a>00784 <span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &v0, <a name="l00785"></a>00785 <span class="keyword">const</span> <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &v1, <a name="l00786"></a>00786 <a class="code" href="classstd_1_1vector.html">std::vector<T></a> &v_out ) <a name="l00787"></a>00787 { <a name="l00788"></a>00788 <a class="code" href="mrpt__macros_8h.html#a47eb5a445c2bf3d9190396510ea9683e">ASSERT_</a>(v0.size()==3) <a name="l00789"></a>00789 <a class="code" href="mrpt__macros_8h.html#a47eb5a445c2bf3d9190396510ea9683e">ASSERT_</a>(v1.size()==3); <a name="l00790"></a>00790 v_out.resize(3); <a name="l00791"></a>00791 v_out[0] = v0[1]*v1[2] - v0[2]*v1[1]; <a name="l00792"></a>00792 v_out[1] = -v0[0]*v1[2] + v0[2]*v1[0]; <a name="l00793"></a>00793 v_out[2] = v0[0]*v1[1] - v0[1]*v1[0]; <a name="l00794"></a>00794 } <a name="l00795"></a>00795 <span class="comment"></span> <a name="l00796"></a>00796 <span class="comment"> //! \overload (returning a vector of size 3 by value).</span> <a name="l00797"></a>00797 <span class="comment"></span> <span class="keyword">template</span><<span class="keyword">class</span> VEC1,<span class="keyword">class</span> VEC2> <a name="l00798"></a><a class="code" href="group__geometry__grp.html#ga8434b52fe61bfea34a87705c3c296b9e">00798</a> <span class="keyword">inline</span> Eigen::Matrix<double,3,1> <a class="code" href="group__geometry__grp.html#gad8d6fbe91133eb0caa6722ae378ea3fb" title="Computes the cross product of two 3D vectors, returning a vector normal to both.">crossProduct3D</a>(<span class="keyword">const</span> VEC1 &v0,<span class="keyword">const</span> VEC2 &v1) { <a name="l00799"></a>00799 Eigen::Matrix<double,3,1> vOut; <a name="l00800"></a>00800 vOut[0]=v0[1]*v1[2]-v0[2]*v1[1]; <a name="l00801"></a>00801 vOut[1]=v0[2]*v1[0]-v0[0]*v1[2]; <a name="l00802"></a>00802 vOut[2]=v0[0]*v1[1]-v0[1]*v1[0]; <a name="l00803"></a>00803 <span class="keywordflow">return</span> vOut; <a name="l00804"></a>00804 } <a name="l00805"></a>00805 <span class="comment"></span> <a name="l00806"></a>00806 <span class="comment"> /** Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array:</span> <a name="l00807"></a>00807 <span class="comment"> * \f[ M([x ~ y ~ z]^\top) = \left(</span> <a name="l00808"></a>00808 <span class="comment"> * \begin{array}{c c c}</span> <a name="l00809"></a>00809 <span class="comment"> * 0 & -z & y \\</span> <a name="l00810"></a>00810 <span class="comment"> * z & 0 & -x \\</span> <a name="l00811"></a>00811 <span class="comment"> * -y & x & 0</span> <a name="l00812"></a>00812 <span class="comment"> * \end{array} \right)</span> <a name="l00813"></a>00813 <span class="comment"> * \f]</span> <a name="l00814"></a>00814 <span class="comment"> */</span> <a name="l00815"></a>00815 <span class="keyword">template</span><<span class="keyword">class</span> VECTOR,<span class="keyword">class</span> MATRIX> <a name="l00816"></a><a class="code" href="group__geometry__grp.html#ga1d062ce80412bd12f853b032f7822edb">00816</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#ga1d062ce80412bd12f853b032f7822edb" title="Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array: .">skew_symmetric3</a>(<span class="keyword">const</span> VECTOR &v,MATRIX& M) { <a name="l00817"></a>00817 <a class="code" href="mrpt__macros_8h.html#a47eb5a445c2bf3d9190396510ea9683e">ASSERT_</a>(v.size()==3) <a name="l00818"></a>00818 M.setSize(3,3); <a name="l00819"></a>00819 M.set_unsafe(0,0, 0); M.set_unsafe(0,1, -v[2]); M.set_unsafe(0,2, v[1]); <a name="l00820"></a>00820 M.set_unsafe(1,0, v[2]); M.set_unsafe(1,1, 0); M.set_unsafe(1,2, -v[0]); <a name="l00821"></a>00821 M.set_unsafe(2,0, -v[1]); M.set_unsafe(2,1, v[0]); M.set_unsafe(2,2, 0); <a name="l00822"></a>00822 }<span class="comment"></span> <a name="l00823"></a>00823 <span class="comment"> //! \overload</span> <a name="l00824"></a>00824 <span class="comment"></span> <span class="keyword">template</span><<span class="keyword">class</span> VECTOR> <a name="l00825"></a><a class="code" href="group__geometry__grp.html#ga885c8e7de7ba80f5d314d4ec0a161d02">00825</a> <span class="keyword">inline</span> mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_fixed_numeric.html">::math::CMatrixDouble33</a> <a class="code" href="group__geometry__grp.html#ga1d062ce80412bd12f853b032f7822edb" title="Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array: .">skew_symmetric3</a>(<span class="keyword">const</span> VECTOR &v) { <a name="l00826"></a>00826 mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_fixed_numeric.html">::math::CMatrixDouble33</a> M(<a class="code" href="namespacemrpt_1_1math.html#a27e8ae8971ff5aa1c39f1f9be334d73aa28acc66160006cb691487ec89f8d266d">UNINITIALIZED_MATRIX</a>); <a name="l00827"></a>00827 <a class="code" href="group__geometry__grp.html#ga1d062ce80412bd12f853b032f7822edb" title="Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array: .">skew_symmetric3</a>(v,M); <a name="l00828"></a>00828 <span class="keywordflow">return</span> M; <a name="l00829"></a>00829 } <a name="l00830"></a>00830 <span class="comment"></span> <a name="l00831"></a>00831 <span class="comment"> /** Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array:</span> <a name="l00832"></a>00832 <span class="comment"> * \f[ -M([x ~ y ~ z]^\top) = \left(</span> <a name="l00833"></a>00833 <span class="comment"> * \begin{array}{c c c}</span> <a name="l00834"></a>00834 <span class="comment"> * 0 & z & -y \\</span> <a name="l00835"></a>00835 <span class="comment"> * -z & 0 & x \\</span> <a name="l00836"></a>00836 <span class="comment"> * y & -x & 0</span> <a name="l00837"></a>00837 <span class="comment"> * \end{array} \right)</span> <a name="l00838"></a>00838 <span class="comment"> * \f]</span> <a name="l00839"></a>00839 <span class="comment"> */</span> <a name="l00840"></a>00840 <span class="keyword">template</span><<span class="keyword">class</span> VECTOR,<span class="keyword">class</span> MATRIX> <a name="l00841"></a><a class="code" href="group__geometry__grp.html#gaa6594f63ac8850608581cbda8c2425c9">00841</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gaa6594f63ac8850608581cbda8c2425c9" title="Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array: ...">skew_symmetric3_neg</a>(<span class="keyword">const</span> VECTOR &v,MATRIX& M) { <a name="l00842"></a>00842 <a class="code" href="mrpt__macros_8h.html#a47eb5a445c2bf3d9190396510ea9683e">ASSERT_</a>(v.size()==3) <a name="l00843"></a>00843 M.setSize(3,3); <a name="l00844"></a>00844 M.set_unsafe(0,0, 0); M.set_unsafe(0,1, v[2]); M.set_unsafe(0,2, -v[1]); <a name="l00845"></a>00845 M.set_unsafe(1,0, -v[2]); M.set_unsafe(1,1, 0); M.set_unsafe(1,2, v[0]); <a name="l00846"></a>00846 M.set_unsafe(2,0, v[1]); M.set_unsafe(2,1, -v[0]); M.set_unsafe(2,2, 0); <a name="l00847"></a>00847 }<span class="comment"></span> <a name="l00848"></a>00848 <span class="comment"> //! \overload</span> <a name="l00849"></a>00849 <span class="comment"></span> <span class="keyword">template</span><<span class="keyword">class</span> VECTOR> <a name="l00850"></a><a class="code" href="group__geometry__grp.html#ga88a1a74aa8e47de309e4b00dfb1b2d9b">00850</a> <span class="keyword">inline</span> mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_fixed_numeric.html">::math::CMatrixDouble33</a> <a class="code" href="group__geometry__grp.html#gaa6594f63ac8850608581cbda8c2425c9" title="Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array: ...">skew_symmetric3_neg</a>(<span class="keyword">const</span> VECTOR &v) { <a name="l00851"></a>00851 mrpt<a class="code" href="classmrpt_1_1math_1_1_c_matrix_fixed_numeric.html">::math::CMatrixDouble33</a> M(<a class="code" href="namespacemrpt_1_1math.html#a27e8ae8971ff5aa1c39f1f9be334d73aa28acc66160006cb691487ec89f8d266d">UNINITIALIZED_MATRIX</a>); <a name="l00852"></a>00852 <a class="code" href="group__geometry__grp.html#gaa6594f63ac8850608581cbda8c2425c9" title="Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array: ...">skew_symmetric3_neg</a>(v,M); <a name="l00853"></a>00853 <span class="keywordflow">return</span> M; <a name="l00854"></a>00854 } <a name="l00855"></a>00855 <a name="l00856"></a>00856 <span class="comment"></span> <a name="l00857"></a>00857 <span class="comment"> /**</span> <a name="l00858"></a>00858 <span class="comment"> * Returns true if two 2D vectors are parallel. The arguments may be points, arrays, etc.</span> <a name="l00859"></a>00859 <span class="comment"> */</span> <a name="l00860"></a><a class="code" href="group__geometry__grp.html#ga02898caca2e86295b143fddb35be2d02">00860</a> <span class="keyword">template</span><<span class="keyword">class</span> T,<span class="keyword">class</span> U> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga02898caca2e86295b143fddb35be2d02" title="Returns true if two 2D vectors are parallel.">vectorsAreParallel2D</a>(<span class="keyword">const</span> T &v1,<span class="keyword">const</span> U &v2) { <a name="l00861"></a>00861 <span class="keywordflow">return</span> <a class="code" href="group__metric__grp.html#gaf15608f8914516f8d949a8c053d55021">abs</a>(v1[0]*v2[1]-v2[0]*v1[1])<<a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>; <a name="l00862"></a>00862 } <a name="l00863"></a>00863 <span class="comment"></span> <a name="l00864"></a>00864 <span class="comment"> /**</span> <a name="l00865"></a>00865 <span class="comment"> * Returns true if two 3D vectors are parallel. The arguments may be points, arrays, etc.</span> <a name="l00866"></a>00866 <span class="comment"> */</span> <a name="l00867"></a>00867 <span class="keyword">template</span><<span class="keyword">class</span> T,<span class="keyword">class</span> U> <a name="l00868"></a><a class="code" href="group__geometry__grp.html#ga8e6c754edead58282fc8bc2fe030a28f">00868</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga8e6c754edead58282fc8bc2fe030a28f" title="Returns true if two 3D vectors are parallel.">vectorsAreParallel3D</a>(<span class="keyword">const</span> T &v1,<span class="keyword">const</span> U &v2) { <a name="l00869"></a>00869 <span class="keywordflow">if</span> (<a class="code" href="group__metric__grp.html#gaf15608f8914516f8d949a8c053d55021">abs</a>(v1[0]*v2[1]-v2[0]*v1[1])>=<a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00870"></a>00870 <span class="keywordflow">if</span> (<a class="code" href="group__metric__grp.html#gaf15608f8914516f8d949a8c053d55021">abs</a>(v1[1]*v2[2]-v2[1]*v1[2])>=<a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00871"></a>00871 <span class="keywordflow">return</span> <a class="code" href="group__metric__grp.html#gaf15608f8914516f8d949a8c053d55021">abs</a>(v1[2]*v2[0]-v2[2]*v1[0])<<a class="code" href="group__geometry__grp.html#ga1c443a200f0be17fb54bfc78c62acf45" title="Global epsilon to overcome small precision errors.">geometryEpsilon</a>; <a name="l00872"></a>00872 } <a name="l00873"></a>00873 <span class="comment"></span> <a name="l00874"></a>00874 <span class="comment"> /** Computes the closest point from a given point to a segment, and returns that minimum distance.</span> <a name="l00875"></a>00875 <span class="comment"> */</span> <a name="l00876"></a>00876 <span class="keywordtype">double</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#gad9aef76403111b275219b248ef857f0d" title="Computes the closest point from a given point to a segment, and returns that minimum distance...">minimumDistanceFromPointToSegment</a>( <a name="l00877"></a>00877 <span class="keyword">const</span> <span class="keywordtype">double</span> & Px, <a name="l00878"></a>00878 <span class="keyword">const</span> <span class="keywordtype">double</span> & Py, <a name="l00879"></a>00879 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1, <a name="l00880"></a>00880 <span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00881"></a>00881 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2, <a name="l00882"></a>00882 <span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00883"></a>00883 <span class="keywordtype">double</span> & out_x, <a name="l00884"></a>00884 <span class="keywordtype">double</span> & out_y); <a name="l00885"></a>00885 <span class="comment"></span> <a name="l00886"></a>00886 <span class="comment"> /** Computes the closest point from a given point to a segment, and returns that minimum distance.</span> <a name="l00887"></a>00887 <span class="comment"> */</span> <a name="l00888"></a>00888 <span class="keywordtype">double</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#gad9aef76403111b275219b248ef857f0d" title="Computes the closest point from a given point to a segment, and returns that minimum distance...">minimumDistanceFromPointToSegment</a>( <a name="l00889"></a>00889 <span class="keyword">const</span> <span class="keywordtype">double</span> & Px, <a name="l00890"></a>00890 <span class="keyword">const</span> <span class="keywordtype">double</span> & Py, <a name="l00891"></a>00891 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1, <a name="l00892"></a>00892 <span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00893"></a>00893 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2, <a name="l00894"></a>00894 <span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00895"></a>00895 <span class="keywordtype">float</span> & out_x, <a name="l00896"></a>00896 <span class="keywordtype">float</span> & out_y); <a name="l00897"></a>00897 <a name="l00898"></a>00898 <span class="comment"></span> <a name="l00899"></a>00899 <span class="comment"> /** Computes the closest point from a given point to a segment.</span> <a name="l00900"></a>00900 <span class="comment"> * \sa closestFromPointToLine</span> <a name="l00901"></a>00901 <span class="comment"> */</span> <a name="l00902"></a>00902 <span class="keywordtype">void</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#gae7ede60214c324413b05a0624523d20c" title="Computes the closest point from a given point to a segment.">closestFromPointToSegment</a>( <a name="l00903"></a>00903 <span class="keyword">const</span> <span class="keywordtype">double</span> & Px, <a name="l00904"></a>00904 <span class="keyword">const</span> <span class="keywordtype">double</span> & Py, <a name="l00905"></a>00905 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1, <a name="l00906"></a>00906 <span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00907"></a>00907 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2, <a name="l00908"></a>00908 <span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00909"></a>00909 <span class="keywordtype">double</span> &out_x, <a name="l00910"></a>00910 <span class="keywordtype">double</span> &out_y); <a name="l00911"></a>00911 <span class="comment"></span> <a name="l00912"></a>00912 <span class="comment"> /** Computes the closest point from a given point to a (infinite) line.</span> <a name="l00913"></a>00913 <span class="comment"> * \sa closestFromPointToSegment</span> <a name="l00914"></a>00914 <span class="comment"> */</span> <a name="l00915"></a>00915 <span class="keywordtype">void</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#gac5f11f2c4b55831c3ffff7131b8e8c5f" title="Computes the closest point from a given point to a (infinite) line.">closestFromPointToLine</a>( <a name="l00916"></a>00916 <span class="keyword">const</span> <span class="keywordtype">double</span> & Px, <a name="l00917"></a>00917 <span class="keyword">const</span> <span class="keywordtype">double</span> & Py, <a name="l00918"></a>00918 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1, <a name="l00919"></a>00919 <span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00920"></a>00920 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2, <a name="l00921"></a>00921 <span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00922"></a>00922 <span class="keywordtype">double</span> &out_x, <a name="l00923"></a>00923 <span class="keywordtype">double</span> &out_y); <a name="l00924"></a>00924 <span class="comment"></span> <a name="l00925"></a>00925 <span class="comment"> /** Returns the square distance from a point to a line.</span> <a name="l00926"></a>00926 <span class="comment"> */</span> <a name="l00927"></a>00927 <span class="keywordtype">double</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#ga34b47b2f0ce0b415dbbc012d416eb8f8" title="Returns the square distance from a point to a line.">closestSquareDistanceFromPointToLine</a>( <a name="l00928"></a>00928 <span class="keyword">const</span> <span class="keywordtype">double</span> & Px, <a name="l00929"></a>00929 <span class="keyword">const</span> <span class="keywordtype">double</span> & Py, <a name="l00930"></a>00930 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1, <a name="l00931"></a>00931 <span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00932"></a>00932 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2, <a name="l00933"></a>00933 <span class="keyword">const</span> <span class="keywordtype">double</span> & y2 ); <a name="l00934"></a>00934 <a name="l00935"></a>00935 <span class="comment"></span> <a name="l00936"></a>00936 <span class="comment"> /** Returns the distance between 2 points in 2D. */</span> <a name="l00937"></a>00937 <span class="keyword">template</span> <<span class="keyword">typename</span> T> <a name="l00938"></a><a class="code" href="group__geometry__grp.html#gaa750f334af9804daea1b6c748fb5544f">00938</a> T <a class="code" href="group__geometry__grp.html#gaa750f334af9804daea1b6c748fb5544f" title="Returns the distance between 2 points in 2D.">distanceBetweenPoints</a>(<span class="keyword">const</span> T x1,<span class="keyword">const</span> T y1,<span class="keyword">const</span> T x2,<span class="keyword">const</span> T y2) { <a name="l00939"></a>00939 <span class="keywordflow">return</span> std::sqrt( <a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(x1-x2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(y1-y2) ); <a name="l00940"></a>00940 } <a name="l00941"></a>00941 <span class="comment"></span> <a name="l00942"></a>00942 <span class="comment"> /** Returns the distance between 2 points in 3D. */</span> <a name="l00943"></a>00943 <span class="keyword">template</span> <<span class="keyword">typename</span> T> <a name="l00944"></a><a class="code" href="group__geometry__grp.html#gaf9f23698674258694e4ccf1b65d883d9">00944</a> T <a class="code" href="group__geometry__grp.html#gaa750f334af9804daea1b6c748fb5544f" title="Returns the distance between 2 points in 2D.">distanceBetweenPoints</a>(<span class="keyword">const</span> T x1,<span class="keyword">const</span> T y1,<span class="keyword">const</span> T z1, <span class="keyword">const</span> T x2,<span class="keyword">const</span> T y2, <span class="keyword">const</span> T z2) { <a name="l00945"></a>00945 <span class="keywordflow">return</span> std::sqrt( <a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(x1-x2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(y1-y2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(z1-z2) ); <a name="l00946"></a>00946 } <a name="l00947"></a>00947 <span class="comment"></span> <a name="l00948"></a>00948 <span class="comment"> /** Returns the square distance between 2 points in 2D. */</span> <a name="l00949"></a>00949 <span class="keyword">template</span> <<span class="keyword">typename</span> T> <a name="l00950"></a><a class="code" href="group__geometry__grp.html#ga317e06b958f0d87add2bf964a831f4a6">00950</a> T <a class="code" href="group__geometry__grp.html#ga317e06b958f0d87add2bf964a831f4a6" title="Returns the square distance between 2 points in 2D.">distanceSqrBetweenPoints</a>(<span class="keyword">const</span> T x1,<span class="keyword">const</span> T y1,<span class="keyword">const</span> T x2,<span class="keyword">const</span> T y2) { <a name="l00951"></a>00951 <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>(x1-x2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(y1-y2); <a name="l00952"></a>00952 } <a name="l00953"></a>00953 <span class="comment"></span> <a name="l00954"></a>00954 <span class="comment"> /** Returns the square distance between 2 points in 3D. */</span> <a name="l00955"></a>00955 <span class="keyword">template</span> <<span class="keyword">typename</span> T> <a name="l00956"></a><a class="code" href="group__geometry__grp.html#ga43a105e4de12406d0f1ec02bfa068efd">00956</a> T <a class="code" href="group__geometry__grp.html#ga317e06b958f0d87add2bf964a831f4a6" title="Returns the square distance between 2 points in 2D.">distanceSqrBetweenPoints</a>(<span class="keyword">const</span> T x1,<span class="keyword">const</span> T y1,<span class="keyword">const</span> T z1, <span class="keyword">const</span> T x2,<span class="keyword">const</span> T y2, <span class="keyword">const</span> T z2) { <a name="l00957"></a>00957 <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>(x1-x2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(y1-y2)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(z1-z2); <a name="l00958"></a>00958 } <a name="l00959"></a>00959 <span class="comment"></span> <a name="l00960"></a>00960 <span class="comment"> /** Returns the intersection point, and if it exists, between two segments.</span> <a name="l00961"></a>00961 <span class="comment"> */</span> <a name="l00962"></a>00962 <span class="keywordtype">bool</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#gae1e629aecd4f3ef90c946f7922f628d2" title="Returns the intersection point, and if it exists, between two segments.">SegmentsIntersection</a>( <a name="l00963"></a>00963 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1,<span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00964"></a>00964 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2,<span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00965"></a>00965 <span class="keyword">const</span> <span class="keywordtype">double</span> & x3,<span class="keyword">const</span> <span class="keywordtype">double</span> & y3, <a name="l00966"></a>00966 <span class="keyword">const</span> <span class="keywordtype">double</span> & x4,<span class="keyword">const</span> <span class="keywordtype">double</span> & y4, <a name="l00967"></a>00967 <span class="keywordtype">double</span> &ix,<span class="keywordtype">double</span> &iy); <a name="l00968"></a>00968 <span class="comment"></span> <a name="l00969"></a>00969 <span class="comment"> /** Returns the intersection point, and if it exists, between two segments.</span> <a name="l00970"></a>00970 <span class="comment"> */</span> <a name="l00971"></a>00971 <span class="keywordtype">bool</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#gae1e629aecd4f3ef90c946f7922f628d2" title="Returns the intersection point, and if it exists, between two segments.">SegmentsIntersection</a>( <a name="l00972"></a>00972 <span class="keyword">const</span> <span class="keywordtype">double</span> & x1,<span class="keyword">const</span> <span class="keywordtype">double</span> & y1, <a name="l00973"></a>00973 <span class="keyword">const</span> <span class="keywordtype">double</span> & x2,<span class="keyword">const</span> <span class="keywordtype">double</span> & y2, <a name="l00974"></a>00974 <span class="keyword">const</span> <span class="keywordtype">double</span> & x3,<span class="keyword">const</span> <span class="keywordtype">double</span> & y3, <a name="l00975"></a>00975 <span class="keyword">const</span> <span class="keywordtype">double</span> & x4,<span class="keyword">const</span> <span class="keywordtype">double</span> & y4, <a name="l00976"></a>00976 <span class="keywordtype">float</span> &ix,<span class="keywordtype">float</span> &iy); <a name="l00977"></a>00977 <span class="comment"></span> <a name="l00978"></a>00978 <span class="comment"> /** Returns true if the 2D point (px,py) falls INTO the given polygon.</span> <a name="l00979"></a>00979 <span class="comment"> * \sa pointIntoQuadrangle</span> <a name="l00980"></a>00980 <span class="comment"> */</span> <a name="l00981"></a>00981 <span class="keywordtype">bool</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#ga2d3279e82ce6d2c47c8152079a3ef281" title="Returns true if the 2D point (px,py) falls INTO the given polygon.">pointIntoPolygon2D</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> & px, <span class="keyword">const</span> <span class="keywordtype">double</span> & py, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> polyEdges, <span class="keyword">const</span> <span class="keywordtype">double</span> *poly_xs, <span class="keyword">const</span> <span class="keywordtype">double</span> *poly_ys ); <a name="l00982"></a>00982 <span class="comment"></span> <a name="l00983"></a>00983 <span class="comment"> /** Specialized method to check whether a point (x,y) falls into a quadrangle.</span> <a name="l00984"></a>00984 <span class="comment"> * \sa pointIntoPolygon2D</span> <a name="l00985"></a>00985 <span class="comment"> */</span> <a name="l00986"></a>00986 <span class="keyword">template</span> <<span class="keyword">typename</span> T> <a name="l00987"></a><a class="code" href="group__geometry__grp.html#ga7a045689c27da5ed560fb9c0da6afece">00987</a> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga7a045689c27da5ed560fb9c0da6afece" title="Specialized method to check whether a point (x,y) falls into a quadrangle.">pointIntoQuadrangle</a>( <a name="l00988"></a>00988 T x, T <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>, <a name="l00989"></a>00989 T v1x, T v1y, <a name="l00990"></a>00990 T v2x, T v2y, <a name="l00991"></a>00991 T v3x, T v3y, <a name="l00992"></a>00992 T v4x, T v4y ) <a name="l00993"></a>00993 { <a name="l00994"></a>00994 <span class="keyword">using</span> mrpt<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">::utils::sign</a>; <a name="l00995"></a>00995 <a name="l00996"></a>00996 <span class="keyword">const</span> T a1 = atan2( v1y - y , v1x - x ); <a name="l00997"></a>00997 <span class="keyword">const</span> T a2 = atan2( v2y - y , v2x - x ); <a name="l00998"></a>00998 <span class="keyword">const</span> T a3 = atan2( v3y - y , v3x - x ); <a name="l00999"></a>00999 <span class="keyword">const</span> T a4 = atan2( v4y - y , v4x - x ); <a name="l01000"></a>01000 <a name="l01001"></a>01001 <span class="comment">// The point is INSIDE iff all the signs of the angles between each vertex</span> <a name="l01002"></a>01002 <span class="comment">// and the next one are equal.</span> <a name="l01003"></a>01003 <span class="keyword">const</span> T da1 = <a class="code" href="group__container__ops__grp.html#gaa2ddb99c5a5532075417f855b1c132fd" title="Modifies the given angle to translate it into the ]-pi,pi] range.">mrpt::math::wrapToPi</a>( a2-a1 ); <a name="l01004"></a>01004 <span class="keyword">const</span> T da2 = <a class="code" href="group__container__ops__grp.html#gaa2ddb99c5a5532075417f855b1c132fd" title="Modifies the given angle to translate it into the ]-pi,pi] range.">mrpt::math::wrapToPi</a>( a3-a2 ); <a name="l01005"></a>01005 <span class="keywordflow">if</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da1)!=<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da2)) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01006"></a>01006 <a name="l01007"></a>01007 <span class="keyword">const</span> T da3 = <a class="code" href="group__container__ops__grp.html#gaa2ddb99c5a5532075417f855b1c132fd" title="Modifies the given angle to translate it into the ]-pi,pi] range.">mrpt::math::wrapToPi</a>( a4-a3 ); <a name="l01008"></a>01008 <span class="keywordflow">if</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da2)!=<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da3)) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01009"></a>01009 <a name="l01010"></a>01010 <span class="keyword">const</span> T da4 = <a class="code" href="group__container__ops__grp.html#gaa2ddb99c5a5532075417f855b1c132fd" title="Modifies the given angle to translate it into the ]-pi,pi] range.">mrpt::math::wrapToPi</a>( a1-a4 ); <a name="l01011"></a>01011 <span class="keywordflow">return</span> (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da3)==<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da4) && (<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da4)==<a class="code" href="namespacemrpt_1_1utils.html#a21a7fa6910f4a4281087f2b35e0f7423" title="Returns the sign of X as "1" or "-1".">sign</a>(da1))); <a name="l01012"></a>01012 } <a name="l01013"></a>01013 <span class="comment"></span> <a name="l01014"></a>01014 <span class="comment"> /** Returns the closest distance of a given 2D point to a polygon, or "0" if the point is INTO the polygon or its perimeter.</span> <a name="l01015"></a>01015 <span class="comment"> */</span> <a name="l01016"></a>01016 <span class="keywordtype">double</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#ga4a37a7be7002726067dc30938747136c" title="Returns the closest distance of a given 2D point to a polygon, or "0" if the point is INTO the polygo...">distancePointToPolygon2D</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> & px, <span class="keyword">const</span> <span class="keywordtype">double</span> & py, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> polyEdges, <span class="keyword">const</span> <span class="keywordtype">double</span> *poly_xs, <span class="keyword">const</span> <span class="keywordtype">double</span> *poly_ys ); <a name="l01017"></a>01017 <span class="comment"></span> <a name="l01018"></a>01018 <span class="comment"> /** Calculates the minimum distance between a pair of lines.</span> <a name="l01019"></a>01019 <span class="comment"> The lines are given by:</span> <a name="l01020"></a>01020 <span class="comment"> - Line 1 = P1 + f (P2-P1)</span> <a name="l01021"></a>01021 <span class="comment"> - Line 2 = P3 + f (P4-P3)</span> <a name="l01022"></a>01022 <span class="comment"> The Euclidean distance is returned in "dist", and the mid point between the lines in (x,y,z)</span> <a name="l01023"></a>01023 <span class="comment"> \return It returns false if there is no solution, i.e. lines are (almost, up to EPS) parallel.</span> <a name="l01024"></a>01024 <span class="comment"> */</span> <a name="l01025"></a>01025 <span class="keywordtype">bool</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#ga65cdc0ef2b5080fbd70b5c8019da00dc" title="Calculates the minimum distance between a pair of lines.">minDistBetweenLines</a>( <a name="l01026"></a>01026 <span class="keyword">const</span> <span class="keywordtype">double</span> & p1_x, <span class="keyword">const</span> <span class="keywordtype">double</span> & p1_y, <span class="keyword">const</span> <span class="keywordtype">double</span> & p1_z, <a name="l01027"></a>01027 <span class="keyword">const</span> <span class="keywordtype">double</span> & p2_x, <span class="keyword">const</span> <span class="keywordtype">double</span> & p2_y, <span class="keyword">const</span> <span class="keywordtype">double</span> & p2_z, <a name="l01028"></a>01028 <span class="keyword">const</span> <span class="keywordtype">double</span> & p3_x, <span class="keyword">const</span> <span class="keywordtype">double</span> & p3_y, <span class="keyword">const</span> <span class="keywordtype">double</span> & p3_z, <a name="l01029"></a>01029 <span class="keyword">const</span> <span class="keywordtype">double</span> & p4_x, <span class="keyword">const</span> <span class="keywordtype">double</span> & p4_y, <span class="keyword">const</span> <span class="keywordtype">double</span> & p4_z, <a name="l01030"></a>01030 <span class="keywordtype">double</span> &x, <span class="keywordtype">double</span> &<a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>, <span class="keywordtype">double</span> &z, <a name="l01031"></a>01031 <span class="keywordtype">double</span> &dist); <a name="l01032"></a>01032 <span class="comment"></span> <a name="l01033"></a>01033 <span class="comment"> /** Returns wether two rotated rectangles intersect.</span> <a name="l01034"></a>01034 <span class="comment"> * The first rectangle is not rotated and given by (R1_x_min,R1_x_max)-(R1_y_min,R1_y_max).</span> <a name="l01035"></a>01035 <span class="comment"> * The second rectangle is given is a similar way, but it is internally rotated according</span> <a name="l01036"></a>01036 <span class="comment"> * to the given coordinates translation (R2_pose_x,R2_pose_y,R2_pose_phi(radians)), relative</span> <a name="l01037"></a>01037 <span class="comment"> * to the coordinates system of rectangle 1.</span> <a name="l01038"></a>01038 <span class="comment"> */</span> <a name="l01039"></a>01039 <span class="keywordtype">bool</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#ga47a389f6645848187e5b8490d20c6bf0" title="Returns wether two rotated rectangles intersect.">RectanglesIntersection</a>( <a name="l01040"></a>01040 <span class="keyword">const</span> <span class="keywordtype">double</span> & R1_x_min, <span class="keyword">const</span> <span class="keywordtype">double</span> & R1_x_max, <a name="l01041"></a>01041 <span class="keyword">const</span> <span class="keywordtype">double</span> & R1_y_min, <span class="keyword">const</span> <span class="keywordtype">double</span> & R1_y_max, <a name="l01042"></a>01042 <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_x_min, <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_x_max, <a name="l01043"></a>01043 <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_y_min, <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_y_max, <a name="l01044"></a>01044 <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_pose_x, <a name="l01045"></a>01045 <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_pose_y, <a name="l01046"></a>01046 <span class="keyword">const</span> <span class="keywordtype">double</span> & R2_pose_phi ); <a name="l01047"></a>01047 <span class="comment"></span> <a name="l01048"></a>01048 <span class="comment"> /** Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of them.</span> <a name="l01049"></a>01049 <span class="comment"> * NOTE: Make sure of passing all floats or doubles and that the template of the receiving matrix is of the same type!</span> <a name="l01050"></a>01050 <span class="comment"> *</span> <a name="l01051"></a>01051 <span class="comment"> * If \f$ d = [ dx ~ dy ~ dz ] \f$ is the input vector, then this function returns a matrix \f$ M \f$ such as:</span> <a name="l01052"></a>01052 <span class="comment"> *</span> <a name="l01053"></a>01053 <span class="comment"> \f[ M = \left(</span> <a name="l01054"></a>01054 <span class="comment"> \begin{array}{c c c}</span> <a name="l01055"></a>01055 <span class="comment"> v^1_x ~ v^2_x ~ v^3_x \\</span> <a name="l01056"></a>01056 <span class="comment"> v^1_y ~ v^2_y ~ v^3_y \\</span> <a name="l01057"></a>01057 <span class="comment"> v^1_z ~ v^2_z ~ v^3_z</span> <a name="l01058"></a>01058 <span class="comment"> \end{array} \right)</span> <a name="l01059"></a>01059 <span class="comment"> \f]</span> <a name="l01060"></a>01060 <span class="comment"> *</span> <a name="l01061"></a>01061 <span class="comment"> * And the three normal vectors are computed as:</span> <a name="l01062"></a>01062 <span class="comment"></span> <a name="l01063"></a>01063 <span class="comment"> \f[ v^1 = \frac{d}{|d|} \f]</span> <a name="l01064"></a>01064 <span class="comment"></span> <a name="l01065"></a>01065 <span class="comment"> If (dx!=0 or dy!=0):</span> <a name="l01066"></a>01066 <span class="comment"> \f[ v^2 = \frac{[-dy ~ dx ~ 0 ]}{\sqrt{dx^2+dy^2}} \f]</span> <a name="l01067"></a>01067 <span class="comment"> otherwise (the direction vector is vertical):</span> <a name="l01068"></a>01068 <span class="comment"> \f[ v^2 = [1 ~ 0 ~ 0] \f]</span> <a name="l01069"></a>01069 <span class="comment"></span> <a name="l01070"></a>01070 <span class="comment"> And finally, the third vector is the cross product of the others:</span> <a name="l01071"></a>01071 <span class="comment"></span> <a name="l01072"></a>01072 <span class="comment"> \f[ v^3 = v^1 \times v^2 \f]</span> <a name="l01073"></a>01073 <span class="comment"> *</span> <a name="l01074"></a>01074 <span class="comment"> * \return The 3x3 matrix (CMatrixTemplateNumeric<T>), containing one vector per column.</span> <a name="l01075"></a>01075 <span class="comment"> * \except Throws an std::exception on invalid input (i.e. null direction vector)</span> <a name="l01076"></a>01076 <span class="comment"> *</span> <a name="l01077"></a>01077 <span class="comment"> * (JLB @ 18-SEP-2007)</span> <a name="l01078"></a>01078 <span class="comment"> */</span> <a name="l01079"></a>01079 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l01080"></a><a class="code" href="group__geometry__grp.html#gac393ef41292790bb8983997c5e1fda56">01080</a> <a class="code" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html" title="A matrix of dynamic size.">CMatrixTemplateNumeric<T></a> <a class="code" href="group__geometry__grp.html#gac393ef41292790bb8983997c5e1fda56" title="Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of the...">generateAxisBaseFromDirection</a>( T dx, T dy, T dz ) <a name="l01081"></a>01081 { <a name="l01082"></a>01082 <a class="code" href="mrpt__macros_8h.html#a45b840af519f33816311acdbb28d7c10">MRPT_START</a> <a name="l01083"></a>01083 <a name="l01084"></a>01084 <span class="keywordflow">if</span> (dx==0 && dy==0 && dz==0) <a name="l01085"></a>01085 <a class="code" href="mrpt__macros_8h.html#aaa3f404ea85a6575a7139f8d101370ba">THROW_EXCEPTION</a>(<span class="stringliteral">"Invalid input: Direction vector is (0,0,0)!"</span>); <a name="l01086"></a>01086 <a name="l01087"></a>01087 <a class="code" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html" title="A matrix of dynamic size.">CMatrixTemplateNumeric<T></a> P(3,3); <a name="l01088"></a>01088 <a name="l01089"></a>01089 <span class="comment">// 1st vector:</span> <a name="l01090"></a>01090 T n_xy = <a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(dx)+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(dy); <a name="l01091"></a>01091 T n = sqrt(n_xy+<a class="code" href="namespacemrpt_1_1utils.html#a67cb05bb8ad4e725875a7ee54b7042ae" title="Inline function for the square of a number.">square</a>(dz)); <a name="l01092"></a>01092 n_xy = sqrt(n_xy); <a name="l01093"></a>01093 P(0,0) = dx / n; <a name="l01094"></a>01094 P(1,0) = dy / n; <a name="l01095"></a>01095 P(2,0) = dz / n; <a name="l01096"></a>01096 <a name="l01097"></a>01097 <span class="comment">// 2nd perpendicular vector:</span> <a name="l01098"></a>01098 <span class="keywordflow">if</span> (fabs(dx)>1e-4 || fabs(dy)>1e-4) <a name="l01099"></a>01099 { <a name="l01100"></a>01100 P(0,1) = -dy / n_xy; <a name="l01101"></a>01101 P(1,1) = dx / n_xy; <a name="l01102"></a>01102 P(2,1) = 0; <a name="l01103"></a>01103 } <a name="l01104"></a>01104 <span class="keywordflow">else</span> <a name="l01105"></a>01105 { <a name="l01106"></a>01106 <span class="comment">// Any vector in the XY plane will work:</span> <a name="l01107"></a>01107 P(0,1) = 1; <a name="l01108"></a>01108 P(1,1) = 0; <a name="l01109"></a>01109 P(2,1) = 0; <a name="l01110"></a>01110 } <a name="l01111"></a>01111 <a name="l01112"></a>01112 <span class="comment">// 3rd perpendicular vector: cross product of the two last vectors:</span> <a name="l01113"></a>01113 P.col(2) = <a class="code" href="group__geometry__grp.html#gad8d6fbe91133eb0caa6722ae378ea3fb" title="Computes the cross product of two 3D vectors, returning a vector normal to both.">crossProduct3D</a>(P.col(0),P.col(1)); <a name="l01114"></a>01114 <a name="l01115"></a>01115 <span class="keywordflow">return</span> P; <a name="l01116"></a>01116 <a class="code" href="mrpt__macros_8h.html#a88a917260793b56abd83ad2a0d849eb1">MRPT_END</a> <a name="l01117"></a>01117 } <a name="l01118"></a>01118 <a name="l01119"></a>01119 <span class="comment"></span> <a name="l01120"></a>01120 <span class="comment"> /** Compute a rotation exponential using the Rodrigues Formula.</span> <a name="l01121"></a>01121 <span class="comment"> * The rotation axis is given by \f$\vec{w}\f$, and the rotation angle must</span> <a name="l01122"></a>01122 <span class="comment"> * be computed using \f$ \theta = |\vec{w}|\f$. This is provided as a separate</span> <a name="l01123"></a>01123 <span class="comment"> * function primarily to allow fast and rough matrix exponentials using fast</span> <a name="l01124"></a>01124 <span class="comment"> * and rough approximations to \e A and \e B.</span> <a name="l01125"></a>01125 <span class="comment"> *</span> <a name="l01126"></a>01126 <span class="comment"> * \param w Vector about which to rotate.</span> <a name="l01127"></a>01127 <span class="comment"> * \param A \f$\frac{\sin \theta}{\theta}\f$</span> <a name="l01128"></a>01128 <span class="comment"> * \param B \f$\frac{1 - \cos \theta}{\theta^2}\f$</span> <a name="l01129"></a>01129 <span class="comment"> * \param R Matrix to hold the return value.</span> <a name="l01130"></a>01130 <span class="comment"> * \sa CPose3D</span> <a name="l01131"></a>01131 <span class="comment"> * \note Method from TooN (C) Tom Drummond (GNU GPL)</span> <a name="l01132"></a>01132 <span class="comment"> */</span> <a name="l01133"></a>01133 <span class="keyword">template</span> <<span class="keyword">typename</span> VECTOR_LIKE, <span class="keyword">typename</span> Precision, <span class="keyword">typename</span> MATRIX_LIKE> <a name="l01134"></a><a class="code" href="group__geometry__grp.html#gac093231a869a1c120f56f8f661b11cc4">01134</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__geometry__grp.html#gac093231a869a1c120f56f8f661b11cc4" title="Compute a rotation exponential using the Rodrigues Formula.">rodrigues_so3_exp</a>(<span class="keyword">const</span> VECTOR_LIKE& w, <span class="keyword">const</span> Precision A,<span class="keyword">const</span> Precision B,MATRIX_LIKE & R) <a name="l01135"></a>01135 { <a name="l01136"></a>01136 <a class="code" href="mrpt__macros_8h.html#a02c6e78d47a0bae723824559846cc673">ASSERT_EQUAL_</a>(w.size(),3) <a name="l01137"></a>01137 <a class="code" href="mrpt__macros_8h.html#a02c6e78d47a0bae723824559846cc673">ASSERT_EQUAL_</a>(R.getColCount(),3) <a name="l01138"></a>01138 <a class="code" href="mrpt__macros_8h.html#a02c6e78d47a0bae723824559846cc673">ASSERT_EQUAL_</a>(R.getRowCount(),3) <a name="l01139"></a>01139 { <a name="l01140"></a>01140 <span class="keyword">const</span> Precision wx2 = (Precision)w[0]*w[0]; <a name="l01141"></a>01141 <span class="keyword">const</span> Precision wy2 = (Precision)w[1]*w[1]; <a name="l01142"></a>01142 <span class="keyword">const</span> Precision wz2 = (Precision)w[2]*w[2]; <a name="l01143"></a>01143 R(0,0) = 1.0 - B*(wy2 + wz2); <a name="l01144"></a>01144 R(1,1) = 1.0 - B*(wx2 + wz2); <a name="l01145"></a>01145 R(2,2) = 1.0 - B*(wx2 + wy2); <a name="l01146"></a>01146 } <a name="l01147"></a>01147 { <a name="l01148"></a>01148 <span class="keyword">const</span> Precision a = A*w[2]; <a name="l01149"></a>01149 <span class="keyword">const</span> Precision b = B*(w[0]*w[1]); <a name="l01150"></a>01150 R(0,1) = b - a; <a name="l01151"></a>01151 R(1,0) = b + a; <a name="l01152"></a>01152 } <a name="l01153"></a>01153 { <a name="l01154"></a>01154 <span class="keyword">const</span> Precision a = A*w[1]; <a name="l01155"></a>01155 <span class="keyword">const</span> Precision b = B*(w[0]*w[2]); <a name="l01156"></a>01156 R(0,2) = b + a; <a name="l01157"></a>01157 R(2,0) = b - a; <a name="l01158"></a>01158 } <a name="l01159"></a>01159 { <a name="l01160"></a>01160 <span class="keyword">const</span> Precision a = A*w[0]; <a name="l01161"></a>01161 <span class="keyword">const</span> Precision b = B*(w[1]*w[2]); <a name="l01162"></a>01162 R(1,2) = b - a; <a name="l01163"></a>01163 R(2,1) = b + a; <a name="l01164"></a>01164 } <a name="l01165"></a>01165 } <a name="l01166"></a>01166 <span class="comment"></span> <a name="l01167"></a>01167 <span class="comment"> /** @} */</span> <span class="comment">// end of misc. geom. methods</span> <a name="l01168"></a>01168 <span class="comment"></span> <a name="l01169"></a>01169 <span class="comment"> /** @} */</span> <span class="comment">// end of grouping</span> <a name="l01170"></a>01170 <a name="l01171"></a>01171 } <span class="comment">// End of namespace</span> <a name="l01172"></a>01172 <a name="l01173"></a>01173 } <span class="comment">// End of namespace</span> <a name="l01174"></a>01174 <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>