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