00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 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 opengl_CPolyhedron_H 00029 #define opengl_CPolyhedron_H 00030 00031 #include <mrpt/opengl/CRenderizableDisplayList.h> 00032 #include <mrpt/utils/stl_extensions.h> 00033 #include <mrpt/math/geometry.h> 00034 00035 namespace mrpt { 00036 namespace opengl { 00037 using namespace mrpt::utils; 00038 using namespace mrpt::poses; 00039 using namespace std; 00040 00041 class OPENGL_IMPEXP CPolyhedron; 00042 00043 // This must be added to any CSerializable derived class: 00044 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(CPolyhedron,CRenderizableDisplayList, OPENGL_IMPEXP) 00045 /** 00046 * This class represents arbitrary polyhedra. The class includes a set of static methods to create common polyhedrons. The class includes many methods to create standard polyhedra, not intended to be fast but to be simple. For example, the dodecahedron is not created efficiently: first, an icosahedron is created, and a duality operator is applied to it, which yields the dodecahedron. This way, code is much smaller, although much slower. This is not a big problem, since polyhedron creation does not usually take a significant amount of time (they are created once and rendered many times). 00047 * Polyhedra information and models have been gotten from the Wikipedia, http://wikipedia.org 00048 * \sa opengl::COpenGLScene 00049 * 00050 * <div align="center"> 00051 * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;"> 00052 * <tr> <td> mrpt::opengl::CPolyhedron </td> <td> \image html preview_CPolyhedron.png </td> </tr> 00053 * </table> 00054 * </div> 00055 * 00056 * \ingroup mrpt_opengl_grp 00057 */ 00058 class OPENGL_IMPEXP CPolyhedron:public CRenderizableDisplayList { 00059 DEFINE_SERIALIZABLE(CPolyhedron) 00060 public: 00061 /** 00062 * Struct used to store a polyhedron edge. The struct consists only of two vertex indices, used to access the polyhedron vertex list. 00063 */ 00064 struct OPENGL_IMPEXP TPolyhedronEdge { 00065 /** 00066 * First vertex. 00067 */ 00068 uint32_t v1; 00069 /** 00070 * Second vertex. 00071 */ 00072 uint32_t v2; 00073 /** 00074 * Default constructor. Initializes to garbage. 00075 */ 00076 TPolyhedronEdge():v1(),v2() {} 00077 /** 00078 * Comparison agains another edge. Simmetry is taken into account. 00079 */ 00080 bool operator==(const TPolyhedronEdge &e) const { 00081 if (e.v1==v1&&e.v2==v2) return true; 00082 else return e.v1==v2&&e.v2==v1; 00083 } 00084 /** 00085 * Given a set of vertices, computes the length of the vertex. 00086 */ 00087 double length(const vector<TPoint3D> &vs) const; 00088 /** 00089 * Destructor. 00090 */ 00091 ~TPolyhedronEdge() {} 00092 }; 00093 /** 00094 * Struct used to store a polyhedron face. Consists on a set of vertex indices and a normal vector. 00095 */ 00096 struct OPENGL_IMPEXP TPolyhedronFace { 00097 /** 00098 * Vector of indices to the vertex list. 00099 */ 00100 vector<uint32_t> vertices; 00101 /** 00102 * Normal vector. 00103 */ 00104 double normal[3]; 00105 /** 00106 * Fast default constructor. Initializes to garbage. 00107 */ 00108 TPolyhedronFace():vertices() {} 00109 /** 00110 * Destructor. 00111 */ 00112 ~TPolyhedronFace() {} 00113 /** 00114 * Given a set of vertices, computes the area of this face. 00115 */ 00116 double area(const vector<TPoint3D> &vertices) const; 00117 /** 00118 * Given a set of vertices, get this face's center. 00119 */ 00120 void getCenter(const vector<TPoint3D> &vertices,TPoint3D &p) const; 00121 }; 00122 protected: 00123 /** 00124 * List of vertices presents in the polyhedron. 00125 */ 00126 vector<TPoint3D> mVertices; 00127 /** 00128 * List of polyhedron's edges. 00129 */ 00130 vector<TPolyhedronEdge> mEdges; 00131 /** 00132 * List of polyhedron's faces. 00133 */ 00134 vector<TPolyhedronFace> mFaces; 00135 /** 00136 * This flag determines whether the polyhedron will be displayed as a solid object or as a set of edges. 00137 */ 00138 bool mWireframe; 00139 /** 00140 * When displaying as wireframe object, this variable stores the width of the edges. 00141 */ 00142 double mLineWidth; 00143 /** 00144 * Mutable list of actual polygons, maintained for speed. 00145 */ 00146 mutable std::vector<TPolygonWithPlane> tempPolygons; 00147 /** 00148 * Whether the set of actual polygons is up to date or not. 00149 */ 00150 mutable bool polygonsUpToDate; 00151 public: 00152 /** 00153 * Creation of a polyhedron from its vertices and faces. 00154 * \throw logic_error if the polyhedron definition has flaws (bad vertex indices, etc.). 00155 */ 00156 inline static CPolyhedronPtr Create(const vector<TPoint3D> &vertices,const vector<vector<uint32_t> > &faces) { 00157 vector<TPolyhedronFace> aux; 00158 for (vector<vector<uint32_t> >::const_iterator it=faces.begin();it!=faces.end();++it) { 00159 TPolyhedronFace f; 00160 f.vertices=*it; 00161 aux.push_back(f); 00162 } 00163 return Create(vertices,aux); 00164 } 00165 /** 00166 * Creation of a polyhedron from its vertices and faces. 00167 * \throw logic_error if the polyhedron definition has flaws (bad vertex indices, etc.). 00168 */ 00169 inline static CPolyhedronPtr Create(const vector<TPoint3D> &vertices,const vector<TPolyhedronFace> &faces) { 00170 return CPolyhedronPtr(new CPolyhedron(vertices,faces,true)); 00171 } 00172 /** 00173 * Creation from a set of polygons. 00174 * \sa mrpt::math::TPolygon3D 00175 */ 00176 static CPolyhedronPtr Create(const std::vector<math::TPolygon3D> &polys); 00177 00178 //Static methods to create frequent polyhedra. More bizarre polyhedra are intended to be added in a near future. 00179 00180 /** @name Platonic solids. 00181 @{ 00182 */ 00183 /** 00184 * Creates a regular tetrahedron (see http://en.wikipedia.org/wiki/Tetrahedron). The tetrahedron is created as a triangular pyramid whose edges and vertices are transitive. 00185 * The tetrahedron is the dual to itself. 00186 <p align="center"><img src="Tetrahedron.gif"></p> 00187 * \sa CreatePyramid,CreateJohnsonSolidWithConstantBase,CreateTruncatedTetrahedron 00188 */ 00189 inline static CPolyhedronPtr CreateTetrahedron(double radius) { 00190 CPolyhedronPtr tetra=CreateJohnsonSolidWithConstantBase(3,radius*sqrt(8.0)/3.0,"P+"); 00191 for (vector<TPoint3D>::iterator it=tetra->mVertices.begin();it!=tetra->mVertices.end();++it) it->z-=radius/3; 00192 return tetra; 00193 } 00194 /** 00195 * Creates a regular cube, also called hexahedron (see http://en.wikipedia.org/wiki/Hexahedron). The hexahedron is created as a cubic prism which transitive edges. Another ways to create it include: 00196 <ul><li>Dual to an octahedron.</li><li>Parallelepiped with three orthogonal, equally-lengthed vectors.</li><li>Triangular trapezohedron with proper height.</li></ul> 00197 <p align="center"><img src="Hexahedron.gif"></p> 00198 * \sa CreateOctahedron,getDual,CreateParallelepiped,CreateTrapezohedron,CreateTruncatedHexahedron,CreateTruncatedOctahedron,CreateCuboctahedron,CreateRhombicuboctahedron 00199 */ 00200 inline static CPolyhedronPtr CreateHexahedron(double radius) { 00201 if (radius==0.0) return CreateEmpty(); 00202 double r=radius/sqrt(3.0); 00203 return CreateCubicPrism(-r,r,-r,r,-r,r); 00204 } 00205 /** 00206 * Creates a regular octahedron (see http://en.wikipedia.org/wiki/Octahedron). The octahedron is created as a square bipyramid whit transitive edges and vertices. Another ways to create an octahedron are: 00207 <ul><li>Dual to an hexahedron</li><li>Triangular antiprism with transitive vertices.</li><li>Conveniently truncated tetrahedron.</li></ul> 00208 <p align="center"><img src="Octahedron.gif"></p> 00209 * \sa CreateHexahedron,getDual,CreateArchimedeanAntiprism,CreateTetrahedron,truncate,CreateTruncatedOctahedron,CreateTruncatedHexahedron,CreateCuboctahedron,CreateRhombicuboctahedron 00210 */ 00211 inline static CPolyhedronPtr CreateOctahedron(double radius) { 00212 return CreateJohnsonSolidWithConstantBase(4,radius,"P-P+"); 00213 } 00214 /** 00215 * Creates a regular dodecahedron (see http://en.wikipedia.org/wiki/Dodecahedron). The dodecahedron is created as the dual to an icosahedron. 00216 <p align="center"><img src="Dodecahedron.gif"></p> 00217 * \sa CreateIcosahedron,getDual,CreateTruncatedDodecahedron,CreateTruncatedIcosahedron,CreateIcosidodecahedron,CreateRhombicosidodecahedron 00218 */ 00219 inline static CPolyhedronPtr CreateDodecahedron(double radius) { 00220 return CreateIcosahedron(radius/sqrt(15-6*sqrt(5.0)))->getDual(); 00221 } 00222 /** 00223 * Creates a regular icosahedron (see http://en.wikipedia.org/wiki/Icosahedron). The icosahedron is created as a gyroelongated pentagonal bipyramid with transitive edges, and it's the dual to a dodecahedron. 00224 <p align="center"><img src="Icosahedron.gif"></p> 00225 * \sa CreateJohnsonSolidWithConstantBase,CreateDodecahedron,getDual,CreateTruncatedIcosahedron,CreateTruncatedDodecahedron,CreateIcosidodecahedron,CreateRhombicosidodecahedron 00226 */ 00227 inline static CPolyhedronPtr CreateIcosahedron(double radius) { 00228 double ang=M_PI/5; 00229 double s2=4*square(sin(ang)); 00230 double prop=sqrt(s2-1)+sqrt(s2-2+2*cos(ang))/2; 00231 return CreateJohnsonSolidWithConstantBase(5,radius/prop,"P-AP+",1); 00232 } 00233 /** @} 00234 */ 00235 00236 /** @name Archimedean solids. 00237 @{ 00238 */ 00239 /** 00240 * Creates a truncated tetrahedron, consisting of four triangular faces and for hexagonal ones (see http://en.wikipedia.org/wiki/Truncated_tetrahedron). Its dual is the triakis tetrahedron. 00241 <p align="center"><img src="Truncatedtetrahedron.gif"></p> 00242 * \sa CreateTetrahedron,CreateTriakisTetrahedron 00243 */ 00244 inline static CPolyhedronPtr CreateTruncatedTetrahedron(double radius) { 00245 return CreateTetrahedron(radius*sqrt(27.0/11.0))->truncate(2.0/3.0); 00246 } 00247 /** 00248 * Creates a cuboctahedron, consisting of six square faces and eight triangular ones (see http://en.wikipedia.org/wiki/Cuboctahedron). There are several ways to create a cuboctahedron: 00249 <ul><li>Hexahedron truncated to a certain extent.</li><li>Octahedron truncated to a certain extent.</li><li>Cantellated tetrahedron</li><li>Dual to a rhombic dodecahedron.</li></ul> 00250 <p align="center"><img src="Cuboctahedron.gif"></p> 00251 * \sa CreateHexahedron,CreateOctahedron,truncate,CreateTetrahedron,cantellate,CreateRhombicuboctahedron,CreateRhombicDodecahedron, 00252 */ 00253 inline static CPolyhedronPtr CreateCuboctahedron(double radius) { 00254 return CreateHexahedron(radius*sqrt(1.5))->truncate(1.0); 00255 } 00256 /** 00257 * Creates a truncated hexahedron, with six octogonal faces and eight triangular ones (see http://en.wikipedia.org/wiki/Truncated_hexahedron). The truncated octahedron is dual to the triakis octahedron. 00258 <p align="center"><img src="Truncatedhexahedron.gif"></p> 00259 * \sa CreateHexahedron,CreateTriakisOctahedron 00260 */ 00261 inline static CPolyhedronPtr CreateTruncatedHexahedron(double radius) { 00262 return CreateHexahedron(radius*sqrt(3.0/(5-sqrt(8.0))))->truncate(2-sqrt(2.0)); 00263 } 00264 /** 00265 * Creates a truncated octahedron, with eight hexagons and eight squares (see http://en.wikipedia.org/wiki/Truncated_octahedron). It's the dual to the tetrakis hexahedron. 00266 <p align="center"><img src="Truncatedoctahedron.gif"></p> 00267 * \sa CreateOctahedron,CreateTetrakisHexahedron 00268 */ 00269 inline static CPolyhedronPtr CreateTruncatedOctahedron(double radius) { 00270 return CreateOctahedron(radius*3/sqrt(5.0))->truncate(2.0/3.0); 00271 } 00272 /** 00273 * Creates a rhombicuboctahedron, with 18 squares and 8 triangles (see http://en.wikipedia.org/wiki/Rhombicuboctahedron), calculated as an elongated square bicupola. It can also be calculated as a cantellated hexahedron or octahedron, and its dual is the deltoidal icositetrahedron. 00274 * If the second argument is set to false, the lower cupola is rotated, so that the objet created is an elongated square gyrobicupola (see http://en.wikipedia.org/wiki/Elongated_square_gyrobicupola). This is not an archimedean solid, but a Johnson one, since it hasn't got vertex transitivity. 00275 <p align="center"><img src="Rhombicuboctahedron.gif"></p> 00276 * \sa CreateJohnsonSolidWithConstantBase,CreateHexahedron,CreateOctahedron,cantellate,CreateCuboctahedron,CreateDeltoidalIcositetrahedron 00277 */ 00278 inline static CPolyhedronPtr CreateRhombicuboctahedron(double radius,bool type=true) { 00279 return CreateJohnsonSolidWithConstantBase(8,radius/sqrt(1+square(sin(M_PI/8))),type?"C-PRC+":"GC-PRC+",3); 00280 } 00281 /** 00282 * Creates an icosidodecahedron, with 12 pentagons and 20 triangles (see http://en.wikipedia.org/wiki/Icosidodecahedron). Certain truncations of either a dodecahedron or an icosahedron yield an icosidodecahedron. 00283 * The dual of the icosidodecahedron is the rhombic triacontahedron. 00284 * If the second argument is set to false, the lower rotunda is rotated. In this case, the object created is a pentagonal orthobirotunda (see http://en.wikipedia.org/wiki/Pentagonal_orthobirotunda). This object presents symmetry against the XY plane and is not vertex transitive, so it's a Johnson's solid. 00285 <p align="center"><img src="Icosidodecahedron.gif"></p> 00286 * \sa CreateDodecahedron,CreateIcosahedron,truncate,CreateRhombicosidodecahedron,CreateRhombicTriacontahedron 00287 */ 00288 inline static CPolyhedronPtr CreateIcosidodecahedron(double radius,bool type=true) { 00289 return CreateJohnsonSolidWithConstantBase(10,radius,type?"GR-R+":"R-R+",1); 00290 } 00291 /** 00292 * Creates a truncated dodecahedron, consisting of 12 dodecagons and 20 triangles (see http://en.wikipedia.org/wiki/Truncated_dodecahedron). The truncated dodecahedron is the dual to the triakis icosahedron. 00293 <p align="center"><img src="Truncateddodecahedron.gif"></p> 00294 * \sa CreateDodecahedron,CreateTriakisIcosahedron 00295 */ 00296 inline static CPolyhedronPtr CreateTruncatedDodecahedron(double radius) { 00297 return CreateDodecahedron(radius*sqrt(45.0)/sqrt(27+6*sqrt(5.0)))->truncate(1-sqrt(0.2)); 00298 } 00299 /** 00300 * Creates a truncated icosahedron, consisting of 20 hexagons and 12 pentagons. This object resembles a typical soccer ball (see http://en.wikipedia.org/wiki/Truncated_icosahedron). The pentakis dodecahedron is the dual to the truncated icosahedron. 00301 <p align="center"><img src="Truncatedicosahedron.gif"></p> 00302 * \sa CreateIcosahedron,CreatePentakisDodecahedron 00303 */ 00304 inline static CPolyhedronPtr CreateTruncatedIcosahedron(double radius) { 00305 return CreateIcosahedron(radius*sqrt(45.0)/sqrt(25+4*sqrt(5.0)))->truncate(2.0/3.0); 00306 } 00307 /** 00308 * Creates a rhombicosidodecahedron, consisting of 30 squares, 12 pentagons and 20 triangles (see http://en.wikipedia.org/wiki/Rhombicosidodecahedron). This object can be obtained as the cantellation of either a dodecahedron or an icosahedron. The dual of the rhombicosidodecahedron is the deltoidal hexecontahedron. 00309 <p align="center"><img src="Rhombicosidodecahedron.gif"></p> 00310 * \sa CreateDodecahedron,CreateIcosahedron,CreateIcosidodecahedron,CreateDeltoidalHexecontahedron 00311 */ 00312 inline static CPolyhedronPtr CreateRhombicosidodecahedron(double radius) { 00313 return CreateIcosahedron(radius*sqrt(10.0/(35.0+9.0*sqrt(5.0))))->cantellate(1.5*(sqrt(5.0)-1)); 00314 } 00315 /** @} 00316 */ 00317 00318 /** @name Other Johnson solids. 00319 @{ 00320 */ 00321 /** 00322 * Creates a pentagonal rotunda (half an icosidodecahedron), consisting of six pentagons, ten triangles and a decagon (see http://en.wikipedia.org/wiki/Pentagonal_rotunda). 00323 * \sa CreateIcosidodecahedron,CreateJohnsonSolidWithConstantBase 00324 */ 00325 inline static CPolyhedronPtr CreatePentagonalRotunda(double radius) { 00326 return CreateJohnsonSolidWithConstantBase(10,radius,"R+"); 00327 } 00328 /** @} 00329 */ 00330 00331 /** @name Catalan solids. 00332 @{ 00333 */ 00334 /** 00335 * Creates a triakis tetrahedron, dual to the truncated tetrahedron. This body consists of 12 isosceles triangles (see http://en.wikipedia.org/wiki/Triakis_tetrahedron). 00336 <p align="center"><img src="Triakistetrahedron.gif"></p> 00337 * \sa CreateTruncatedTetrahedron 00338 */ 00339 inline static CPolyhedronPtr CreateTriakisTetrahedron(double radius) { 00340 return CreateTruncatedTetrahedron(radius*3/sqrt(33.0))->getDual(); 00341 } 00342 00343 /** 00344 * Creates a rhombic dodecahedron, dual to the cuboctahedron. This body consists of 12 rhombi (see http://en.wikipedia.org/wiki/Rhombic_dodecahedron). 00345 <p align="center"><img src="Rhombicdodecahedron.gif"></p> 00346 * \sa CreateCuboctahedron 00347 */ 00348 inline static CPolyhedronPtr CreateRhombicDodecahedron(double radius) { 00349 return CreateCuboctahedron(radius/sqrt(2.0))->getDual(); 00350 } 00351 00352 /** 00353 * Creates a triakis octahedron, dual to the truncated hexahedron. This body consists of 24 isosceles triangles (see http://en.wikipedia.org/wiki/Triakis_octahedron). 00354 <p align="center"><img src="Triakisoctahedron.gif"></p> 00355 * \sa CreateTruncatedHexahedron 00356 */ 00357 inline static CPolyhedronPtr CreateTriakisOctahedron(double radius) { 00358 return CreateTruncatedHexahedron(radius/sqrt((5-sqrt(8.0))))->getDual(); 00359 } 00360 00361 /** 00362 * Creates a tetrakis hexahedron, dual to the truncated octahedron. This body consists of 24 isosceles triangles (see http://en.wikipedia.org/wiki/Tetrakis_hexahedron). 00363 <p align="center"><img src="Tetrakishexahedron.gif"></p> 00364 * \sa CreateTruncatedOctahedron 00365 */ 00366 inline static CPolyhedronPtr CreateTetrakisHexahedron(double radius) { 00367 return CreateTruncatedOctahedron(radius*sqrt(0.6))->getDual(); 00368 } 00369 00370 /** 00371 * Creates a deltoidal icositetrahedron, dual to the rhombicuboctahedron. This body consists of 24 kites (see http://en.wikipedia.org/wiki/Deltoidal_icositetrahedron). 00372 <p align="center"><img src="Deltoidalicositetrahedron.gif"></p> 00373 * \sa CreateRhombicuboctahedron 00374 */ 00375 inline static CPolyhedronPtr CreateDeltoidalIcositetrahedron(double radius) { 00376 return CreateRhombicuboctahedron(radius/sqrt(7-sqrt(32.0)),true)->getDual(); 00377 } 00378 00379 /** 00380 * Creates a rhombic triacontahedron, dual to the icosidodecahedron. This body consists of 30 rhombi (see http://en.wikipedia.org/wiki/Rhombic_triacontahedron). 00381 <p align="center"><img src="Rhombictriacontahedron.gif"></p> 00382 * \sa CreateIcosidodecahedron 00383 */ 00384 inline static CPolyhedronPtr CreateRhombicTriacontahedron(double radius) { 00385 return CreateIcosidodecahedron(radius*sqrt(2/(5-sqrt(5.0))),true)->getDual(); 00386 } 00387 00388 /** 00389 * Creates a triakis icosahedron, dual to the truncated dodecahedron. This body consists of 60 isosceles triangles http://en.wikipedia.org/wiki/Triakis_icosahedron). 00390 <p align="center"><img src="Triakisicosahedron.gif"></p> 00391 * \sa CreateTruncatedDodecahedron 00392 */ 00393 inline static CPolyhedronPtr CreateTriakisIcosahedron(double radius) { 00394 return CreateTruncatedDodecahedron(radius*sqrt(5/(25-8*sqrt(5.0))))->getDual(); 00395 } 00396 00397 /** 00398 * Creates a pentakis dodecahedron, dual to the truncated icosahedron. This body consists of 60 isosceles triangles (see http://en.wikipedia.org/wiki/Pentakis_dodecahedron). 00399 <p align="center"><img src="Pentakisdodecahedron.gif"></p> 00400 * \sa CreateTruncatedIcosahedron 00401 */ 00402 inline static CPolyhedronPtr CreatePentakisDodecahedron(double radius) { 00403 return CreateTruncatedIcosahedron(radius*sqrt(3/(17-6*sqrt(5.0))))->getDual(); 00404 } 00405 00406 /** 00407 * Creates a deltoidal hexecontahedron, dual to the rhombicosidodecahedron. This body consists of 60 kites (see http://en.wikipedia.org/wiki/Deltoidal_hexecontahedron). 00408 <p align="center"><img src="Deltoidalhexecontahedron.gif"></p> 00409 * \sa CreateRhombicosidodecahedron 00410 */ 00411 inline static CPolyhedronPtr CreateDeltoidalHexecontahedron(double radius) { 00412 return CreateRhombicosidodecahedron(radius*3.0/sqrt(15-2*sqrt(5.0)))->getDual(); 00413 } 00414 /** @} 00415 */ 00416 00417 /** @name Customizable polyhedra 00418 @{ 00419 */ 00420 /** 00421 * Creates a cubic prism, given the coordinates of two opposite vertices. Each edge will be parallel to one of the coordinate axes, although the orientation may change by assigning a pose to the object. 00422 * \sa CreateCubicPrism(const mrpt::math::TPoint3D &,const mrpt::math::TPoint3D &),CreateParallelepiped,CreateCustomPrism,CreateRegularPrism,CreateArchimedeanRegularPrism 00423 */ 00424 static CPolyhedronPtr CreateCubicPrism(double x1,double x2,double y1,double y2,double z1,double z2); 00425 /** 00426 * Creates a cubic prism, given two opposite vertices. 00427 * \sa CreateCubicPrism(double,double,double,double,double,double),CreateParallelepiped,CreateCustomPrism,CreateRegularPrism,CreateArchimedeanRegularPrism 00428 */ 00429 inline static CPolyhedronPtr CreateCubicPrism(const TPoint3D &p1,const TPoint3D &p2) { 00430 return CreateCubicPrism(p1.x,p2.x,p1.y,p2.y,p1.z,p2.z); 00431 } 00432 /** 00433 * Creates a custom pyramid, using a set of 2D vertices which will lie on the XY plane. 00434 * \sa CreateDoublePyramid,CreateFrustum,CreateBifrustum,CreateRegularPyramid 00435 */ 00436 static CPolyhedronPtr CreatePyramid(const vector<TPoint2D> &baseVertices,double height); 00437 /** 00438 * Creates a double pyramid, using a set of 2D vertices which will lie on the XY plane. The second height is used with the downwards pointing pyramid, so that it will effectively point downwards if it's positive. 00439 * \sa CreatePyramid,CreateBifrustum,CreateRegularDoublePyramid 00440 */ 00441 static CPolyhedronPtr CreateDoublePyramid(const vector<TPoint2D> &baseVertices,double height1,double height2); 00442 /** 00443 * Creates a truncated pyramid, using a set of vertices which will lie on the XY plane. 00444 * Do not try to use with a ratio equal to zero; use CreatePyramid instead. When using a ratio of 1, it will create a Prism. 00445 * \sa CreatePyramid,CreateBifrustum 00446 */ 00447 static CPolyhedronPtr CreateTruncatedPyramid(const vector<TPoint2D> &baseVertices,double height,double ratio); 00448 /** 00449 * This is a synonym for CreateTruncatedPyramid. 00450 * \sa CreateTruncatedPyramid 00451 */ 00452 inline static CPolyhedronPtr CreateFrustum(const vector<TPoint2D> &baseVertices,double height,double ratio) { 00453 return CreateTruncatedPyramid(baseVertices,height,ratio); 00454 } 00455 /** 00456 * Creates a custom prism with vertical edges, given any base which will lie on the XY plane. 00457 * \sa CreateCubicPrism,CreateCustomAntiprism,CreateRegularPrism,CreateArchimedeanRegularPrism 00458 */ 00459 inline static CPolyhedronPtr CreateCustomPrism(const vector<TPoint2D> &baseVertices,double height) { 00460 return CreateTruncatedPyramid(baseVertices,height,1.0); 00461 } 00462 /** 00463 * Creates a custom antiprism, using two custom bases. For better results, the top base should be slightly rotated with respect to the bottom one. 00464 * \sa CreateCustomPrism,CreateRegularAntiprism,CreateArchimedeanRegularAntiprism 00465 */ 00466 static CPolyhedronPtr CreateCustomAntiprism(const vector<TPoint2D> &bottomBase,const vector<TPoint2D> &topBase,double height); 00467 /** 00468 * Creates a parallelepiped, given a base point and three vectors represented as points. 00469 * \sa CreateCubicPrism 00470 */ 00471 static CPolyhedronPtr CreateParallelepiped(const TPoint3D &base,const TPoint3D &v1,const TPoint3D &v2,const TPoint3D &v3); 00472 /** 00473 * Creates a bifrustum, or double truncated pyramid, given a base which will lie on the XY plane. 00474 * \sa CreateFrustum,CreateDoublePyramid 00475 */ 00476 static CPolyhedronPtr CreateBifrustum(const vector<TPoint2D> &baseVertices,double height1,double ratio1,double height2,double ratio2); 00477 /** 00478 * Creates a trapezohedron, consisting of 2*N kites, where N is the number of edges in the base. The base radius controls the polyhedron height, whilst the distance between bases affects the height. 00479 * When the number of edges equals 3, the polyhedron is actually a parallelepiped, and it can even be a cube. 00480 */ 00481 static CPolyhedronPtr CreateTrapezohedron(uint32_t numBaseEdges,double baseRadius,double basesDistance); 00482 /** 00483 * Creates an antiprism whose base is a regular polygon. The upper base is rotated \f$\frac\pi N\f$ with respect to the lower one, where N is the number of vertices in the base, and thus the lateral triangles are isosceles. 00484 * \sa CreateCustomAntiprism,CreateArchimedeanRegularAntiprism 00485 */ 00486 inline static CPolyhedronPtr CreateRegularAntiprism(uint32_t numBaseEdges,double baseRadius,double height) { 00487 return CreateCustomAntiprism(generateBase(numBaseEdges,baseRadius),generateShiftedBase(numBaseEdges,baseRadius),height); 00488 } 00489 /** 00490 * Creates a regular prism whose base is a regular polygon and whose edges are either parallel or perpendicular to the XY plane. 00491 * \sa CreateCubicPrism,CreateCustomPrism,CreateArchimedeanRegularAntiprism 00492 */ 00493 inline static CPolyhedronPtr CreateRegularPrism(uint32_t numBaseEdges,double baseRadius,double height) { 00494 return CreateCustomPrism(generateBase(numBaseEdges,baseRadius),height); 00495 } 00496 /** 00497 * Creates a regular pyramid whose base is a regular polygon. 00498 * \sa CreatePyramid 00499 */ 00500 inline static CPolyhedronPtr CreateRegularPyramid(uint32_t numBaseEdges,double baseRadius,double height) { 00501 return CreatePyramid(generateBase(numBaseEdges,baseRadius),height); 00502 } 00503 /** 00504 * Creates a regular double pyramid whose base is a regular polygon. 00505 * \sa CreateDoublePyramid 00506 */ 00507 inline static CPolyhedronPtr CreateRegularDoublePyramid(uint32_t numBaseEdges,double baseRadius,double height1,double height2) { 00508 return CreateDoublePyramid(generateBase(numBaseEdges,baseRadius),height1,height2); 00509 } 00510 /** 00511 * Creates a regular prism whose lateral area is comprised of squares, and so each face of its is a regular polygon. Due to vertex transitivity, the resulting object is always archimedean. 00512 * \sa CreateRegularPrism,CreateCustomPrism 00513 */ 00514 inline static CPolyhedronPtr CreateArchimedeanRegularPrism(uint32_t numBaseEdges,double baseRadius) { 00515 return CreateJohnsonSolidWithConstantBase(numBaseEdges,baseRadius,"PR"); 00516 } 00517 /** 00518 * Creates a regular antiprism whose lateral polygons are equilateral triangles, and so each face of its is a regular polygon. Due to vertex transitivity, the resulting object is always archimedean. 00519 * \sa CreateRegularAntiprism,CreateCustomAntiprism 00520 */ 00521 inline static CPolyhedronPtr CreateArchimedeanRegularAntiprism(uint32_t numBaseEdges,double baseRadius) { 00522 return CreateJohnsonSolidWithConstantBase(numBaseEdges,baseRadius,"A"); 00523 } 00524 /** 00525 * Creates a regular truncated pyramid whose base is a regular polygon. 00526 * \sa CreateTruncatedPyramid 00527 */ 00528 inline static CPolyhedronPtr CreateRegularTruncatedPyramid(uint32_t numBaseEdges,double baseRadius,double height,double ratio) { 00529 return CreateTruncatedPyramid(generateBase(numBaseEdges,baseRadius),height,ratio); 00530 } 00531 /** 00532 * This is a synonym for CreateRegularTruncatedPyramid. 00533 * \sa CreateRegularTruncatedPyramid 00534 */ 00535 inline static CPolyhedronPtr CreateRegularFrustum(uint32_t numBaseEdges,double baseRadius,double height,double ratio) { 00536 return CreateRegularTruncatedPyramid(numBaseEdges,baseRadius,height,ratio); 00537 } 00538 /** 00539 * Creates a bifrustum (double truncated pyramid) whose base is a regular polygon lying in the XY plane. 00540 * \sa CreateBifrustum 00541 */ 00542 inline static CPolyhedronPtr CreateRegularBifrustum(uint32_t numBaseEdges,double baseRadius,double height1,double ratio1,double height2,double ratio2) { 00543 return CreateBifrustum(generateBase(numBaseEdges,baseRadius),height1,ratio1,height2,ratio2); 00544 } 00545 /** 00546 * Creates a cupola. 00547 * \throw std::logic_error if the number of edges is odd or less than four. 00548 */ 00549 inline static CPolyhedronPtr CreateCupola(uint32_t numBaseEdges,double edgeLength) { 00550 return CreateJohnsonSolidWithConstantBase(numBaseEdges,edgeLength/(2*sin(M_PI/numBaseEdges)),"C+"); 00551 } 00552 /** 00553 * Creates a trapezohedron whose dual is exactly an archimedean antiprism. Creates a cube if numBaseEdges is equal to 3. 00554 * \todo Actually resulting height is significantly higher than that passed to the algorithm. 00555 * \sa CreateTrapezohedron,CreateArchimedeanRegularAntiprism,getDual 00556 */ 00557 inline static CPolyhedronPtr CreateCatalanTrapezohedron(uint32_t numBaseEdges,double height) { 00558 return CreateArchimedeanRegularAntiprism(numBaseEdges,height)->getDual(); 00559 } 00560 /** 00561 * Creates a double pyramid whose dual is exactly an archimedean prism. Creates an octahedron if numBaseEdges is equal to 4. 00562 * \todo Actually resulting height is significantly higher than that passed to the algorithm. 00563 * \sa CreateDoublePyramid,CreateArchimedeanRegularPrism,getDual 00564 */ 00565 inline static CPolyhedronPtr CreateCatalanDoublePyramid(uint32_t numBaseEdges,double height) { 00566 return CreateArchimedeanRegularPrism(numBaseEdges,height)->getDual(); 00567 } 00568 /** 00569 * Creates a series of concatenated solids (most of which are prismatoids) whose base is a regular polygon with a given number of edges. Every face of the resulting body will be a regular polygon, so it is a Johnson solid; in special cases, it may be archimedean or even platonic. 00570 * The shape of the body is defined by the string argument, which can include one or more of the following: 00571 <center><table> 00572 <tr><td><b>String</b></td><td><b>Body</b></td><td><b>Restrictions</b></td></tr> 00573 <tr><td>P+</td><td>Upward pointing pyramid</td><td>Must be the last object, vertex number cannot surpass 5</td></tr> 00574 <tr><td>P-</td><td>Downward pointing pyramid</td><td>Must be the first object, vertex number cannot surpass 5</td></tr> 00575 <tr><td>C+</td><td>Upward pointing cupola</td><td>Must be the last object, vertex number must be an even number in the range 4-10.</td></tr> 00576 <tr><td>C-</td><td>Downward pointing cupola</td><td>Must be the first object, vertex number must be an even number in the range 4-10.</td></tr> 00577 <tr><td>GC+</td><td>Upward pointing cupola, rotated</td><td>Must be the last object, vertex number must be an even number in the range 4-10.</td></tr> 00578 <tr><td>GC-</td><td>Downward pointing cupola, rotated</td><td>Must be the first object, vertex number must be an even number in the range 4-10.</td></tr> 00579 <tr><td>PR</td><td>Archimedean prism</td><td>Cannot abut other prism</td></tr> 00580 <tr><td>A</td><td>Archimedean antiprism</td><td>None</td></tr> 00581 <tr><td>R+</td><td>Upward pointing rotunda</td><td>Must be the last object, vertex number must be exactly 10</td></tr> 00582 <tr><td>R-</td><td>Downward pointing rotunda</td><td>Must be the first object, vertex number must be exactly 10</td></tr> 00583 <tr><td>GR+</td><td>Upward pointing rotunda, rotated</td><td>Must be the last object, vertex number must be exactly 10</td></tr> 00584 <tr><td>GR-</td><td>Downward pointing rotunda</td><td>Must be the first object, vertex number must be exactly 10</td></tr> 00585 </table></center> 00586 * Some examples of bodies are: 00587 <center><table> 00588 <tr><td><b>String</b></td><td><b>Vertices</b></td><td><b>Resulting body</b></td></tr> 00589 <tr><td>P+</td><td align="center">3</td><td>Tetrahedron</td></tr> 00590 <tr><td>PR</td><td align="center">4</td><td>Hexahedron</td></tr> 00591 <tr><td>P-P+</td><td align="center">4</td><td>Octahedron</td></tr> 00592 <tr><td>A</td><td align="center">3</td><td>Octahedron</td></tr> 00593 <tr><td>C+PRC-</td><td align="center">8</td><td>Rhombicuboctahedron</td></tr> 00594 <tr><td>P-AP+</td><td align="center">5</td><td>Icosahedron</td></tr> 00595 <tr><td>R-R+</td><td align="center">10</td><td>Icosidodecahedron</td></tr> 00596 </table></center> 00597 */ 00598 static CPolyhedronPtr CreateJohnsonSolidWithConstantBase(uint32_t numBaseEdges,double baseRadius,const std::string &components,size_t shifts=0); 00599 /** @} 00600 */ 00601 00602 /** 00603 * Render 00604 * \sa CRenderizable 00605 */ 00606 void render_dl() const; 00607 /** 00608 * Ray trace 00609 * \sa CRenderizable 00610 */ 00611 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const; 00612 /** 00613 * Gets a list with the polyhedron's vertices. 00614 */ 00615 inline void getVertices(vector<TPoint3D> &vertices) const { 00616 vertices=mVertices; 00617 } 00618 /** 00619 * Gets a list with the polyhedron's edges. 00620 */ 00621 inline void getEdges(vector<TPolyhedronEdge> &edges) const { 00622 edges=mEdges; 00623 } 00624 /** 00625 * Gets a list with the polyhedron's faces. 00626 */ 00627 inline void getFaces(vector<TPolyhedronFace> &faces) const { 00628 faces=mFaces; 00629 } 00630 /** 00631 * Gets the amount of vertices. 00632 */ 00633 inline uint32_t getNumberOfVertices() const { 00634 return mVertices.size(); 00635 } 00636 /** 00637 * Gets the amount of edges. 00638 */ 00639 inline uint32_t getNumberOfEdges() const { 00640 return mEdges.size(); 00641 } 00642 /** 00643 * Gets the amount of faces. 00644 */ 00645 inline uint32_t getNumberOfFaces() const { 00646 return mFaces.size(); 00647 } 00648 /** 00649 * Gets a vector with each edge's length. 00650 */ 00651 void getEdgesLength(vector<double> &lengths) const; 00652 /** 00653 * Gets a vector with each face's area. Won't work properly if the polygons are not convex. 00654 */ 00655 void getFacesArea(vector<double> &areas) const; 00656 /** 00657 * Gets the polyhedron volume. Won't work properly if the polyhedron is not convex. 00658 */ 00659 double getVolume() const; 00660 /** 00661 * Returns whether the polyhedron will be rendered as a wireframe object. 00662 */ 00663 inline bool isWireframe() const { 00664 return mWireframe; 00665 } 00666 /** 00667 * Sets whether the polyhedron will be rendered as a wireframe object. 00668 */ 00669 inline void setWireframe(bool enabled=true) { 00670 mWireframe=enabled; 00671 CRenderizableDisplayList::notifyChange(); 00672 } 00673 /** 00674 * Gets the wireframe lines width. 00675 */ 00676 inline double getLineWidth() const { 00677 return mLineWidth; 00678 } 00679 /** 00680 * Sets the width used to render lines, when wireframe rendering is activated. 00681 */ 00682 inline void setLineWidth(double lineWidth) { 00683 mLineWidth=lineWidth; 00684 CRenderizableDisplayList::notifyChange(); 00685 } 00686 /** 00687 * Gets the polyhedron as a set of polygons. 00688 * \sa mrpt::math::TPolygon3D 00689 */ 00690 void getSetOfPolygons(std::vector<math::TPolygon3D> &vec) const; 00691 /** 00692 * Gets the polyhedron as a set of polygons, with the pose transformation already applied. 00693 * \sa mrpt::math::TPolygon3D,mrpt::poses::CPose3D 00694 */ 00695 void getSetOfPolygonsAbsolute(std::vector<math::TPolygon3D> &vec) const; 00696 /** 00697 * Gets the intersection of two polyhedra, either as a set or as a matrix of intersections. Each intersection is represented by a TObject3D. 00698 * \sa mrpt::math::TObject3D 00699 */ 00700 template<class T> inline static size_t getIntersection(const CPolyhedronPtr &p1,const CPolyhedronPtr &p2,T &container) { 00701 std::vector<TPolygon3D> polys1,polys2; 00702 p1->getSetOfPolygonsAbsolute(polys1); 00703 p2->getSetOfPolygonsAbsolute(polys2); 00704 return mrpt::math::intersect(polys1,polys2,container); 00705 } 00706 /** 00707 * Returns true if the polygon is a completely closed object. 00708 */ 00709 inline bool isClosed() const { 00710 for (size_t i=0;i<mVertices.size();i++) if (edgesInVertex(i)!=facesInVertex(i)) return false; 00711 return true; 00712 } 00713 /** 00714 * Recomputes polygons, if necessary, so that each one is convex. 00715 */ 00716 void makeConvexPolygons(); 00717 /** 00718 * Gets the center of the polyhedron. 00719 */ 00720 void getCenter(TPoint3D ¢er) const; 00721 /** 00722 * Creates a random polyhedron from the static methods. 00723 */ 00724 static CPolyhedronPtr CreateRandomPolyhedron(double radius); 00725 00726 /** @name Polyhedron special operations. 00727 @{ 00728 */ 00729 /** 00730 * Given a polyhedron, creates its dual. 00731 * \sa truncate,cantellate,augment 00732 * \throw std::logic_error Can't get the dual to this polyhedron. 00733 */ 00734 CPolyhedronPtr getDual() const; 00735 /** 00736 * Truncates a polyhedron to a given factor. 00737 * \sa getDual,cantellate,augment 00738 * \throw std::logic_error Polyhedron truncation results in skew polygons and thus it's impossible to perform. 00739 */ 00740 CPolyhedronPtr truncate(double factor) const; 00741 /** 00742 * Cantellates a polyhedron to a given factor. 00743 * \sa getDual,truncate,augment 00744 */ 00745 CPolyhedronPtr cantellate(double factor) const; 00746 /** 00747 * Augments a polyhedron to a given height. This operation is roughly dual to the truncation: given a body P, the operation dtdP and aP yield resembling results. 00748 * \sa getDual,truncate,cantellate 00749 */ 00750 CPolyhedronPtr augment(double height) const; 00751 /** 00752 * Augments a polyhedron to a given height. This method only affects to faces with certain number of vertices. 00753 * \sa augment(double) const 00754 */ 00755 CPolyhedronPtr augment(double height,size_t numVertices) const; 00756 /** 00757 * Augments a polyhedron, so that the resulting triangles are equilateral. If the argument is true, triangles are "cut" from the polyhedron, instead of being added. 00758 * \throw std::logic_error a non-regular face has been found. 00759 * \sa augment(double) const 00760 */ 00761 CPolyhedronPtr augment(bool direction=false) const; 00762 /** 00763 * Augments a polyhedron, so that the resulting triangles are equilateral; affects only faces with certain number of faces. If the second argument is true, triangles are "cut" from the polyhedron. 00764 * \throw std::logic_error a non-regular face has been found. 00765 * \sa augment(double) const 00766 */ 00767 CPolyhedronPtr augment(size_t numVertices,bool direction=false) const; 00768 /** 00769 * Rotates a polyhedron around the Z axis a given amount of radians. In some cases, this operation may be necessary to view the symmetry between related objects. 00770 * \sa scale 00771 */ 00772 CPolyhedronPtr rotate(double angle) const; 00773 /** 00774 * Scales a polyhedron to a given factor. 00775 * \throw std::logic_error factor is not a strictly positive number. 00776 * \sa rotate 00777 */ 00778 CPolyhedronPtr scale(double factor) const; 00779 /** @} 00780 */ 00781 /** 00782 * Updates the mutable list of polygons used in rendering and ray tracing. 00783 */ 00784 void updatePolygons() const; 00785 private: 00786 /** 00787 * Generates a list of 2D vertices constituting a regular polygon. 00788 */ 00789 static vector<TPoint2D> generateBase(uint32_t numBaseEdges,double baseRadius); 00790 /** 00791 * Generates a list of 2D vertices constituting a regular polygon, with an angle shift which makes it suitable for antiprisms. 00792 */ 00793 static vector<TPoint2D> generateShiftedBase(uint32_t numBaseEdges,double baseRadius); 00794 /** 00795 * Generates a list of 3D vertices constituting a regular polygon, appending it to an existing vector. 00796 */ 00797 static void generateBase(uint32_t numBaseEdges,double baseRadius,double height,vector<TPoint3D> &vec); 00798 /** 00799 * Generates a list of 3D vertices constituting a regular polygon conveniently shifted, appending it to an existing vector. 00800 */ 00801 static void generateShiftedBase(uint32_t numBaseEdges,double baseRadius,double height,double shift,vector<TPoint3D> &vec); 00802 /** 00803 * Calculates the normal vector to a face. 00804 */ 00805 bool setNormal(TPolyhedronFace &f,bool doCheck=true); 00806 /** 00807 * Adds, to the existing list of edges, each edge in a given face. 00808 */ 00809 void addEdges(const TPolyhedronFace &e); 00810 /** 00811 * Checks whether a set of faces is suitable for a set of vertices. 00812 */ 00813 static bool checkConsistence(const vector<TPoint3D> &vertices,const vector<TPolyhedronFace> &faces); 00814 /** 00815 * Returns how many edges converge in a given vertex. 00816 */ 00817 size_t edgesInVertex(size_t vertex) const; 00818 /** 00819 * Returns how many faces converge in a given vertex. 00820 */ 00821 size_t facesInVertex(size_t vertex) const; 00822 /** 00823 * Basic empty constructor. 00824 */ 00825 inline CPolyhedron():mVertices(),mEdges(),mFaces(),mWireframe(false),mLineWidth(1),polygonsUpToDate(false) {} 00826 /** 00827 * Basic constructor with a list of vertices and another of faces, checking for correctness. 00828 */ 00829 inline CPolyhedron(const vector<TPoint3D> &vertices,const vector<TPolyhedronFace> &faces,bool doCheck=true):mVertices(vertices),mEdges(),mFaces(faces),mWireframe(false),mLineWidth(1),polygonsUpToDate(false) { 00830 if (doCheck) if (!checkConsistence(vertices,faces)) throw std::logic_error("Face list accesses a vertex out of range"); 00831 for (vector<TPolyhedronFace>::iterator it=mFaces.begin();it!=mFaces.end();++it) { 00832 if (!setNormal(*it,doCheck)) throw std::logic_error("Bad face specification"); 00833 addEdges(*it); 00834 } 00835 } 00836 /** 00837 * Creates a polyhedron without checking its correctness. 00838 */ 00839 inline static CPolyhedronPtr CreateNoCheck(const vector<TPoint3D> &vertices,const vector<TPolyhedronFace> &faces) { 00840 return CPolyhedronPtr(new CPolyhedron(vertices,faces,false)); 00841 } 00842 /** 00843 * Creates an empty Polyhedron. 00844 */ 00845 inline static CPolyhedronPtr CreateEmpty() { 00846 return CPolyhedronPtr(new CPolyhedron()); 00847 } 00848 /** 00849 * Destructor. 00850 */ 00851 virtual ~CPolyhedron() {} 00852 }; 00853 /** 00854 * Reads a polyhedron edge from a binary stream. 00855 */ 00856 OPENGL_IMPEXP mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in,CPolyhedron::TPolyhedronEdge &o); 00857 /** 00858 * Writes a polyhedron edge to a binary stream. 00859 */ 00860 OPENGL_IMPEXP mrpt::utils::CStream& operator<<(mrpt::utils::CStream& out,const CPolyhedron::TPolyhedronEdge &o); 00861 /** 00862 * Reads a polyhedron face from a binary stream. 00863 */ 00864 OPENGL_IMPEXP mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in,CPolyhedron::TPolyhedronFace &o); 00865 /** 00866 * Writes a polyhedron face to a binary stream. 00867 */ 00868 OPENGL_IMPEXP mrpt::utils::CStream& operator<<(mrpt::utils::CStream& out,const CPolyhedron::TPolyhedronFace &o); 00869 } 00870 namespace utils { 00871 using namespace mrpt::opengl; 00872 // Specialization must occur in the same namespace 00873 MRPT_DECLARE_TTYPENAME(CPolyhedron::TPolyhedronEdge) 00874 MRPT_DECLARE_TTYPENAME(CPolyhedron::TPolyhedronFace) 00875 } 00876 } 00877 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |