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 CPOINT3D_H 00029 #define CPOINT3D_H 00030 00031 #include <mrpt/poses/CPoint.h> 00032 00033 namespace mrpt 00034 { 00035 namespace poses 00036 { 00037 class CPose3D; 00038 00039 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CPoint3D, CPoint ) 00040 00041 /** A class used to store a 3D point. 00042 * 00043 * For a complete description of Points/Poses, see mrpt::poses::CPoseOrPoint, or refer 00044 * to the <a href="http://babel.isa.uma.es/mrpt/index.php/2D_3D_Geometry">2D/3D Geometry tutorial</a> in the wiki. 00045 * 00046 00047 <div align=center> 00048 00049 <table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 00050 style='border-collapse:collapse;border:none'> 00051 <tr> 00052 <td width=576 colspan=2 style='width:432.2pt;border:solid windowtext 1.0pt; 00053 background:#E6E6E6;padding:0cm 5.4pt 0cm 5.4pt'> 00054 <p align=center style='text-align:center'>poses::CPoint3D</p> 00055 </td> 00056 </tr> 00057 <tr> 00058 <td width=288 style='width:216.1pt;border:solid windowtext 1.0pt;border-top: 00059 none;padding:0cm 5.4pt 0cm 5.4pt'> 00060 <p align=center style='text-align:center'>Homogeneous 00061 transfomation matrix</p> 00062 </td> 00063 <td width=288 style='width:216.1pt;border-top:none;border-left:none; 00064 border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; 00065 padding:0cm 5.4pt 0cm 5.4pt'> 00066 <p align=center style='text-align:center'>Spatial 00067 representation</p> 00068 </td> 00069 </tr> 00070 <tr style='height:108.3pt'> 00071 <td width=288 style='width:216.1pt;border:solid windowtext 1.0pt;border-top: 00072 none;padding:0cm 5.4pt 0cm 5.4pt;height:108.3pt'> 00073 <div align=center> 00074 <table Table border=0 cellspacing=0 cellpadding=0 width="46%" 00075 style='width:46.84%;border-collapse:collapse'> 00076 <tr style='height:16.5pt'> 00077 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00078 <p align=center style='text-align:center'>1</p> 00079 </td> 00080 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00081 <p align=center style='text-align:center'>0</p> 00082 </td> 00083 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00084 <p align=center style='text-align:center'>0</p> 00085 </td> 00086 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00087 <p align=center style='text-align:center'>x</p> 00088 </td> 00089 </tr> 00090 <tr style='height:16.5pt'> 00091 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00092 <p align=center style='text-align:center'>0</p> 00093 </td> 00094 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00095 <p align=center style='text-align:center'>1</p> 00096 </td> 00097 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00098 <p align=center style='text-align:center'>0</p> 00099 </td> 00100 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00101 <p align=center style='text-align:center'>y</p> 00102 </td> 00103 </tr> 00104 <tr style='height:16.5pt'> 00105 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00106 <p align=center style='text-align:center'>0</p> 00107 </td> 00108 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00109 <p align=center style='text-align:center'>0</p> 00110 </td> 00111 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00112 <p align=center style='text-align:center'>1</p> 00113 </td> 00114 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00115 <p align=center style='text-align:center'>z</p> 00116 </td> 00117 </tr> 00118 <tr style='height:16.5pt'> 00119 <td width=32 style='width:24.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00120 <p align=center style='text-align:center'>0</p> 00121 </td> 00122 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00123 <p align=center style='text-align:center'>0</p> 00124 </td> 00125 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00126 <p align=center style='text-align:center'>0</p> 00127 </td> 00128 <td width=32 style='width:24.05pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.5pt'> 00129 <p align=center style='text-align:center'>1</p> 00130 </td> 00131 </tr> 00132 </table> 00133 </div> 00134 <p align=center style='text-align:center'></p> 00135 </td> 00136 <td width=288 style='width:216.1pt;border-top:none;border-left:none; 00137 border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; 00138 padding:0cm 5.4pt 0cm 5.4pt;height:108.3pt'> 00139 <p align=center style='text-align:center'><img src="CPoint3D.gif"></p> 00140 </td> 00141 </tr> 00142 </table> 00143 00144 </div> 00145 00146 00147 * \sa CPoseOrPoint,CPose, CPoint 00148 */ 00149 class MRPTDLLIMPEXP CPoint3D : public CPoint 00150 { 00151 // This must be added to any CSerializable derived class: 00152 DEFINE_SERIALIZABLE( CPoint3D ) 00153 00154 public: 00155 /** Constructor for initializing point coordinates. 00156 */ 00157 CPoint3D(const double x=0,const double y=0,const double z=0); 00158 00159 /** Constructor from an CPoint2D object. 00160 */ 00161 CPoint3D( const CPoint2D &); 00162 00163 /** Constructor from an CPose3D object. 00164 */ 00165 explicit CPoint3D( const CPose3D &); 00166 00167 /** Constructor from an CPose2D object. 00168 */ 00169 explicit CPoint3D( const CPose2D &); 00170 00171 /** Constructor from lightweight object. 00172 */ 00173 CPoint3D(const mrpt::math::TPoint3D &); 00174 00175 /** Returns this point as seen from "b", i.e. result = this - b 00176 */ 00177 CPoint3D operator - (const CPose3D& b) const; 00178 00179 /** Returns this point minus point "b", i.e. result = this - b 00180 */ 00181 CPoint3D operator - (const CPoint3D& b) const; 00182 00183 /** Returns this point plus point "b", i.e. result = this + b 00184 */ 00185 CPoint3D operator + (const CPoint3D& b) const; 00186 00187 /** Returns this point plus pose "b", i.e. result = this + b 00188 */ 00189 CPose3D operator + (const CPose3D& b) const; 00190 00191 /** Return the pose or point as a 1x3 vector: [x y z] */ 00192 void getAsVector(vector_double &v) const; 00193 00194 /** Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation). 00195 * \sa getInverseHomogeneousMatrix 00196 */ 00197 void getHomogeneousMatrix(CMatrixDouble44 & out_HM ) const 00198 { 00199 out_HM.unit(); 00200 out_HM.get_unsafe(0,3)=m_x; 00201 out_HM.get_unsafe(1,3)=m_y; 00202 out_HM.get_unsafe(2,3)=m_z; 00203 } 00204 00205 }; // End of class def. 00206 00207 00208 std::ostream MRPTDLLIMPEXP & operator << (std::ostream& o, const CPoint3D& p); 00209 00210 bool MRPTDLLIMPEXP operator==(const CPoint3D &p1,const CPoint3D &p2); 00211 bool MRPTDLLIMPEXP operator!=(const CPoint3D &p1,const CPoint3D &p2); 00212 00213 } // End of namespace 00214 } // End of namespace 00215 00216 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:10:56 EDT 2009 |