00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CPOINT2D_H 00029 #define CPOINT2D_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/poses/CPoint.h> 00033 00034 namespace mrpt 00035 { 00036 namespace poses 00037 { 00038 class CPose2D; 00039 class CPose3D; 00040 class CPoint3D; 00041 00042 00043 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPoint2D, CPoint ) 00044 00045 /** A class used to store a 2D point. 00046 * 00047 * For a complete description of Points/Poses, see mrpt::poses::CPoseOrPoint, or refer 00048 * to the <a href="http://babel.isa.uma.es/mrpt/index.php/2D_3D_Geometry">2D/3D Geometry tutorial</a> in the wiki. 00049 * 00050 * 00051 <div align=center> 00052 00053 <table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 00054 style='border-collapse:collapse;border:none'> 00055 <tr> 00056 <td width=576 colspan=2 style='width:432.2pt;border:solid windowtext 1.0pt; 00057 background:#E6E6E6;padding:0cm 5.4pt 0cm 5.4pt'> 00058 <p align=center style='text-align:center'>poses::CPoint2D</p> 00059 </td> 00060 </tr> 00061 <tr> 00062 <td width=288 style='width:216.1pt;border:solid windowtext 1.0pt;border-top: 00063 none;padding:0cm 5.4pt 0cm 5.4pt'> 00064 <p align=center style='text-align:center'>Homogeneous 00065 transfomation matrix</p> 00066 </td> 00067 <td width=288 style='width:216.1pt;border-top:none;border-left:none; 00068 border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; 00069 padding:0cm 5.4pt 0cm 5.4pt'> 00070 <p align=center style='text-align:center'>Spatial 00071 representation</p> 00072 </td> 00073 </tr> 00074 <tr style='height:108.3pt'> 00075 <td width=288 style='width:216.1pt;border:solid windowtext 1.0pt;border-top: 00076 none;padding:0cm 5.4pt 0cm 5.4pt;height:108.3pt'> 00077 <div align=center> 00078 <table Table border=0 cellspacing=0 cellpadding=0 width="46%" 00079 style='width:46.84%;border-collapse:collapse'> 00080 <tr style='height:16.5pt'> 00081 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00082 <p align=center style='text-align:center'>1</p> 00083 </td> 00084 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00085 <p align=center style='text-align:center'>0</p> 00086 </td> 00087 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00088 <p align=center style='text-align:center'>0</p> 00089 </td> 00090 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00091 <p align=center style='text-align:center'>x</p> 00092 </td> 00093 </tr> 00094 <tr style='height:16.5pt'> 00095 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00096 <p align=center style='text-align:center'>0</p> 00097 </td> 00098 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00099 <p align=center style='text-align:center'>1</p> 00100 </td> 00101 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00102 <p align=center style='text-align:center'>0</p> 00103 </td> 00104 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00105 <p align=center style='text-align:center'>y</p> 00106 </td> 00107 </tr> 00108 <tr style='height:16.5pt'> 00109 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00110 <p align=center style='text-align:center'>0</p> 00111 </td> 00112 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00113 <p align=center style='text-align:center'>0</p> 00114 </td> 00115 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00116 <p align=center style='text-align:center'>1</p> 00117 </td> 00118 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00119 <p align=center style='text-align:center'>0</p> 00120 </td> 00121 </tr> 00122 <tr style='height:16.5pt'> 00123 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00124 <p align=center style='text-align:center'>0</p> 00125 </td> 00126 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00127 <p align=center style='text-align:center'>0</p> 00128 </td> 00129 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00130 <p align=center style='text-align:center'>0</p> 00131 </td> 00132 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00133 <p align=center style='text-align:center'>1</p> 00134 </td> 00135 </tr> 00136 </table> 00137 </div> 00138 <p align=center style='text-align:center'></p> 00139 </td> 00140 <td width=288 style='width:216.1pt;border-top:none;border-left:none; 00141 border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; 00142 padding:0cm 5.4pt 0cm 5.4pt;height:108.3pt'> 00143 <p align=center style='text-align:center'><img src="CPoint2D.gif"></p> 00144 </td> 00145 </tr> 00146 </table> 00147 00148 </div> 00149 * \sa CPoseOrPoint,CPose, CPoint 00150 */ 00151 class MRPTDLLIMPEXP CPoint2D : public CPoint 00152 { 00153 // This must be added to any CSerializable derived class: 00154 DEFINE_SERIALIZABLE( CPoint2D ) 00155 00156 public: 00157 /** Constructor for initializing point coordinates. 00158 */ 00159 CPoint2D(double x=0,double y=0); 00160 00161 /** Constructor from x/y coordinates given from other pose. 00162 */ 00163 explicit CPoint2D( const CPose2D &o ); 00164 00165 /** Constructor from x/y coordinates given from other pose. 00166 */ 00167 explicit CPoint2D( const CPose3D &o ); 00168 00169 /** Constructor from x/y coordinates given from a 3D point. 00170 */ 00171 explicit CPoint2D(const CPoint3D &o); 00172 00173 /** Implicit constructor from lightweight type. 00174 */ 00175 CPoint2D(const mrpt::math::TPoint2D &o); 00176 00177 /** The operator D="this"-b is the pose inverse compounding operator, 00178 * the resulting points "D" fulfils: "this" = b + D, so that: b == a + (b-a) 00179 */ 00180 CPoint2D operator - (const CPose2D& b) const; 00181 00182 /** Return the pose or point as a 1x2 vector: [x y] */ 00183 void getAsVector(vector_double &v) const; 00184 00185 /** Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation). 00186 * \sa getInverseHomogeneousMatrix 00187 */ 00188 void getHomogeneousMatrix(CMatrixDouble44 & out_HM ) const 00189 { 00190 out_HM.unit(); 00191 out_HM.get_unsafe(0,3)= m_x; 00192 out_HM.get_unsafe(1,3)= m_y; 00193 } 00194 00195 }; // End of class def. 00196 00197 00198 /** Textual output stream function. 00199 */ 00200 std::ostream MRPTDLLIMPEXP &operator << (std::ostream& o, const CPoint2D& p); 00201 00202 /** Used by STL algorithms */ 00203 bool MRPTDLLIMPEXP operator < (const CPoint2D &a, const CPoint2D &b); 00204 00205 bool MRPTDLLIMPEXP operator==(const CPoint2D &p1,const CPoint2D &p2); 00206 bool MRPTDLLIMPEXP operator!=(const CPoint2D &p1,const CPoint2D &p2); 00207 00208 } // End of namespace 00209 } // End of namespace 00210 00211 #endif
Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:21:34 EDT 2009 |