#include <mrpt/opengl/CPolyhedron.h>
Customizable polyhedra | |
static CPolyhedronPtr | CreateCubicPrism (double x1, double x2, double y1, double y2, double z1, double z2) |
Creates a cubic prism, given the coordinates of two opposite vertices. | |
static CPolyhedronPtr | CreateCubicPrism (const TPoint3D &p1, const TPoint3D &p2) |
Creates a cubic prism, given two opposite vertices. | |
static CPolyhedronPtr | CreatePyramid (const vector< TPoint2D > &baseVertices, double height) |
Creates a custom pyramid, using a set of 2D vertices which will lie on the XY plane. | |
static CPolyhedronPtr | CreateDoublePyramid (const vector< TPoint2D > &baseVertices, double height1, double height2) |
Creates a double pyramid, using a set of 2D vertices which will lie on the XY plane. | |
static CPolyhedronPtr | CreateTruncatedPyramid (const vector< TPoint2D > &baseVertices, double height, double ratio) |
Creates a truncated pyramid, using a set of vertices which will lie on the XY plane. | |
static CPolyhedronPtr | CreateCustomPrism (const vector< TPoint2D > &baseVertices, double height) |
Creates a custom prism with vertical edges, given any base which will lie on the XY plane. | |
static CPolyhedronPtr | CreateCustomAntiprism (const vector< TPoint2D > &bottomBase, const vector< TPoint2D > &topBase, double height) |
Creates a custom antiprism, using two custom bases. | |
static CPolyhedronPtr | CreateParallelepiped (const TPoint3D &base, const TPoint3D &v1, const TPoint3D &v2, const TPoint3D &v3) |
Creates a parallelepiped, given a base point and three vectors represented as points. | |
static CPolyhedronPtr | CreateBifrustum (const vector< TPoint2D > &baseVertices, double height1, double ratio1, double height2, double ratio2) |
Creates a bifrustum, or double truncated pyramid, given a base which will lie on the XY plane. | |
static CPolyhedronPtr | CreateTrapezohedron (uint32_t numBaseEdges, double baseRadius, double basesDistance) |
Creates a trapezohedron, consisting of 2*N kites, where N is the number of edges in the base. | |
static CPolyhedronPtr | CreateRegularAntiprism (uint32_t numBaseEdges, double baseRadius, double height) |
Creates an antiprism whose base is a regular polygon. | |
static CPolyhedronPtr | CreateRegularPrism (uint32_t numBaseEdges, double baseRadius, double height) |
Creates a regular prism whose base is a regular polygon and whose edges are either parallel or perpendicular to the XY plane. | |
static CPolyhedronPtr | CreateRegularPyramid (uint32_t numBaseEdges, double baseRadius, double height) |
Creates a regular pyramid whose base is a regular polygon. | |
static CPolyhedronPtr | CreateRegularDoublePyramid (uint32_t numBaseEdges, double baseRadius, double height1, double height2) |
Creates a regular double pyramid whose base is a regular polygon. | |
static CPolyhedronPtr | CreateArchimedeanRegularPrism (uint32_t numBaseEdges, double baseRadius) |
Creates a regular prism whose lateral area is comprised of squares, and so each face of its is a regular polygon. | |
static CPolyhedronPtr | CreateArchimedeanRegularAntiprism (uint32_t numBaseEdges, double baseRadius) |
Creates a regular antiprism whose lateral polygons are equilateral triangles, and so each face of its is a regular polygon. | |
static CPolyhedronPtr | CreateRegularTruncatedPyramid (uint32_t numBaseEdges, double baseRadius, double height, double ratio) |
Creates a regular truncated pyramid whose base is a regular polygon. | |
static CPolyhedronPtr | CreateRegularFrustum (uint32_t numBaseEdges, double baseRadius, double height, double ratio) |
This is a synonym for CreateRegularTruncatedPyramid. | |
static CPolyhedronPtr | CreateRegularBifrustum (uint32_t numBaseEdges, double baseRadius, double height1, double ratio1, double height2, double ratio2) |
Creates a bifrustum (double truncated pyramid) whose base is a regular polygon lying in the XY plane. | |
static CPolyhedronPtr | CreateCupola (uint32_t numBaseEdges, double edgeLength) |
Creates a cupola. | |
static CPolyhedronPtr | CreateCatalanTrapezohedron (uint32_t numBaseEdges, double height) |
Creates a trapezohedron whose dual is exactly an archimedean antiprism. | |
static CPolyhedronPtr | CreateCatalanDoublePyramid (uint32_t numBaseEdges, double height) |
Creates a double pyramid whose dual is exactly an archimedean prism. | |
static CPolyhedronPtr | CreateJohnsonSolidWithConstantBase (uint32_t numBaseEdges, double baseRadius, const std::string &components, size_t shifts=0) |
Creates a series of concatenated solids (most of which are prismatoids) whose base is a regular polygon with a given number of edges. | |
CPolyhedronPtr | CreateFrustum (const vector< TPoint2D > &baseVertices, double height, double ratio) |
This is a synonym for CreateTruncatedPyramid. | |
Classes | |
struct | TPolyhedronEdge |
Struct used to store a polyhedron edge. More... | |
struct | TPolyhedronFace |
Struct used to store a polyhedron face. More... | |
Public Member Functions | |
void | render () const |
Render. | |
virtual bool | traceRay (const mrpt::poses::CPose3D &o, double &dist) const |
Ray trace. | |
void | getVertices (vector< TPoint3D > &vertices) const |
Gets a list with the polyhedron's vertices. | |
void | getEdges (vector< TPolyhedronEdge > &edges) const |
Gets a list with the polyhedron's edges. | |
void | getFaces (vector< TPolyhedronFace > &faces) const |
Gets a list with the polyhedron's faces. | |
uint32_t | getNumberOfVertices () const |
Gets the amount of vertices. | |
uint32_t | getNumberOfEdges () const |
Gets the amount of edges. | |
uint32_t | getNumberOfFaces () const |
Gets the amount of faces. | |
void | getEdgesLength (vector< double > &lengths) const |
Gets a vector with each edge's length. | |
void | getFacesArea (vector< double > &areas) const |
Gets a vector with each face's area. | |
double | getVolume () const |
Gets the polyhedron volume. | |
bool | isWireframe () const |
Returns whether the polyhedron will be rendered as a wireframe object. | |
void | setWireframe (bool enabled=true) |
Sets whether the polyhedron will be rendered as a wireframe object. | |
double | getLineWidth () const |
Gets the wireframe lines width. | |
void | setLineWidth (double lineWidth) |
Sets the width used to render lines, when wireframe rendering is activated. | |
void | getSetOfPolygons (std::vector< math::TPolygon3D > &vec) const |
Gets the polyhedron as a set of polygons. | |
void | getSetOfPolygonsAbsolute (std::vector< math::TPolygon3D > &vec) const |
Gets the polyhedron as a set of polygons, with the pose transformation already applied. | |
bool | isClosed () const |
Returns true if the polygon is a completely closed object. | |
void | makeConvexPolygons () |
Recomputes polygons, if necessary, so that each one is convex. | |
void | getCenter (TPoint3D ¢er) const |
Gets the center of the polyhedron. | |
void | updatePolygons () const |
Updates the mutable list of polygons used in rendering and ray tracing. | |
Polyhedron special operations. | |
CPolyhedronPtr | getDual () const |
Given a polyhedron, creates its dual. | |
CPolyhedronPtr | truncate (double factor) const |
Truncates a polyhedron to a given factor. | |
CPolyhedronPtr | cantellate (double factor) const |
Cantellates a polyhedron to a given factor. | |
CPolyhedronPtr | augment (double height) const |
Augments a polyhedron to a given height. | |
CPolyhedronPtr | augment (double height, size_t numVertices) const |
Augments a polyhedron to a given height. | |
CPolyhedronPtr | augment (bool direction=false) const |
Augments a polyhedron, so that the resulting triangles are equilateral. | |
CPolyhedronPtr | augment (size_t numVertices, bool direction=false) const |
Augments a polyhedron, so that the resulting triangles are equilateral; affects only faces with certain number of faces. | |
CPolyhedronPtr | rotate (double angle) const |
Rotates a polyhedron around the Z axis a given amount of radians. | |
CPolyhedronPtr | scale (double factor) const |
Scales a polyhedron to a given factor. | |
Static Public Member Functions | |
static CPolyhedronPtr | Create (const vector< TPoint3D > &vertices, const vector< vector< uint32_t > > &faces) |
Creation of a polyhedron from its vertices and faces. | |
static CPolyhedronPtr | Create (const vector< TPoint3D > &vertices, const vector< TPolyhedronFace > &faces) |
Creation of a polyhedron from its vertices and faces. | |
static CPolyhedronPtr | Create (const std::vector< math::TPolygon3D > &polys) |
Creation from a set of polygons. | |
template<class T > | |
static size_t | getIntersection (const CPolyhedronPtr &p1, const CPolyhedronPtr &p2, T &container) |
Gets the intersection of two polyhedra, either as a set or as a matrix of intersections. | |
static CPolyhedronPtr | CreateRandomPolyhedron (double radius) |
Creates a random polyhedron from the static methods. | |
Platonic solids. | |
static CPolyhedronPtr | CreateTetrahedron (double radius) |
Creates a regular tetrahedron (see http://en.wikipedia.org/wiki/Tetrahedron). | |
static CPolyhedronPtr | CreateHexahedron (double radius) |
Creates a regular cube, also called hexahedron (see http://en.wikipedia.org/wiki/Hexahedron). | |
static CPolyhedronPtr | CreateOctahedron (double radius) |
Creates a regular octahedron (see http://en.wikipedia.org/wiki/Octahedron). | |
static CPolyhedronPtr | CreateDodecahedron (double radius) |
Creates a regular dodecahedron (see http://en.wikipedia.org/wiki/Dodecahedron). | |
static CPolyhedronPtr | CreateIcosahedron (double radius) |
Creates a regular icosahedron (see http://en.wikipedia.org/wiki/Icosahedron). | |
Archimedean solids. | |
static CPolyhedronPtr | CreateTruncatedTetrahedron (double radius) |
Creates a truncated tetrahedron, consisting of four triangular faces and for hexagonal ones (see http://en.wikipedia.org/wiki/Truncated_tetrahedron). | |
static CPolyhedronPtr | CreateCuboctahedron (double radius) |
Creates a cuboctahedron, consisting of six square faces and eight triangular ones (see http://en.wikipedia.org/wiki/Cuboctahedron). | |
static CPolyhedronPtr | CreateTruncatedHexahedron (double radius) |
Creates a truncated hexahedron, with six octogonal faces and eight triangular ones (see http://en.wikipedia.org/wiki/Truncated_hexahedron). | |
static CPolyhedronPtr | CreateTruncatedOctahedron (double radius) |
Creates a truncated octahedron, with eight hexagons and eight squares (see http://en.wikipedia.org/wiki/Truncated_octahedron). | |
static CPolyhedronPtr | CreateRhombicuboctahedron (double radius, bool type=true) |
Creates a rhombicuboctahedron, with 18 squares and 8 triangles (see http://en.wikipedia.org/wiki/Rhombicuboctahedron), calculated as an elongated square bicupola. | |
static CPolyhedronPtr | CreateIcosidodecahedron (double radius, bool type=true) |
Creates an icosidodecahedron, with 12 pentagons and 20 triangles (see http://en.wikipedia.org/wiki/Icosidodecahedron). | |
static CPolyhedronPtr | CreateTruncatedDodecahedron (double radius) |
Creates a truncated dodecahedron, consisting of 12 dodecagons and 20 triangles (see http://en.wikipedia.org/wiki/Truncated_dodecahedron). | |
static CPolyhedronPtr | CreateTruncatedIcosahedron (double radius) |
Creates a truncated icosahedron, consisting of 20 hexagons and 12 pentagons. | |
static CPolyhedronPtr | CreateRhombicosidodecahedron (double radius) |
Creates a rhombicosidodecahedron, consisting of 30 squares, 12 pentagons and 20 triangles (see http://en.wikipedia.org/wiki/Rhombicosidodecahedron). | |
Other Johnson solids. | |
static CPolyhedronPtr | CreatePentagonalRotunda (double radius) |
Creates a pentagonal rotunda (half an icosidodecahedron), consisting of six pentagons, ten triangles and a decagon (see http://en.wikipedia.org/wiki/Pentagonal_rotunda). | |
Catalan solids. | |
static CPolyhedronPtr | CreateTriakisTetrahedron (double radius) |
Creates a triakis tetrahedron, dual to the truncated tetrahedron. | |
static CPolyhedronPtr | CreateRhombicDodecahedron (double radius) |
Creates a rhombic dodecahedron, dual to the cuboctahedron. | |
static CPolyhedronPtr | CreateTriakisOctahedron (double radius) |
Creates a triakis octahedron, dual to the truncated hexahedron. | |
static CPolyhedronPtr | CreateTetrakisHexahedron (double radius) |
Creates a tetrakis hexahedron, dual to the truncated octahedron. | |
static CPolyhedronPtr | CreateDeltoidalIcositetrahedron (double radius) |
Creates a deltoidal icositetrahedron, dual to the rhombicuboctahedron. | |
static CPolyhedronPtr | CreateRhombicTriacontahedron (double radius) |
Creates a rhombic triacontahedron, dual to the icosidodecahedron. | |
static CPolyhedronPtr | CreateTriakisIcosahedron (double radius) |
Creates a triakis icosahedron, dual to the truncated dodecahedron. | |
static CPolyhedronPtr | CreatePentakisDodecahedron (double radius) |
Creates a pentakis dodecahedron, dual to the truncated icosahedron. | |
static CPolyhedronPtr | CreateDeltoidalHexecontahedron (double radius) |
Creates a deltoidal hexecontahedron, dual to the rhombicosidodecahedron. | |
Protected Attributes | |
vector< TPoint3D > | mVertices |
List of vertices presents in the polyhedron. | |
vector< TPolyhedronEdge > | mEdges |
List of polyhedron's edges. | |
vector< TPolyhedronFace > | mFaces |
List of polyhedron's faces. | |
bool | mWireframe |
This flag determines whether the polyhedron will be displayed as a solid object or as a set of edges. | |
double | mLineWidth |
When displaying as wireframe object, this variable stores the width of the edges. | |
std::vector< TPolygonWithPlane > | tempPolygons |
Mutable list of actual polygons, maintained for speed. | |
bool | polygonsUpToDate |
Whether the set of actual polygons is up to date or not. | |
Private Member Functions | |
bool | setNormal (TPolyhedronFace &f, bool doCheck=true) |
Calculates the normal vector to a face. | |
void | addEdges (const TPolyhedronFace &e) |
Adds, to the existing list of edges, each edge in a given face. | |
size_t | edgesInVertex (size_t vertex) const |
Returns how many edges converge in a given vertex. | |
size_t | facesInVertex (size_t vertex) const |
Returns how many faces converge in a given vertex. | |
CPolyhedron () | |
Basic empty constructor. | |
CPolyhedron (const vector< TPoint3D > &vertices, const vector< TPolyhedronFace > &faces, bool doCheck=true) | |
Basic constructor with a list of vertices and another of faces, checking for correctness. | |
virtual | ~CPolyhedron () |
Destructor. | |
Static Private Member Functions | |
static vector< TPoint2D > | generateBase (uint32_t numBaseEdges, double baseRadius) |
Generates a list of 2D vertices constituting a regular polygon. | |
static vector< TPoint2D > | generateShiftedBase (uint32_t numBaseEdges, double baseRadius) |
Generates a list of 2D vertices constituting a regular polygon, with an angle shift which makes it suitable for antiprisms. | |
static void | generateBase (uint32_t numBaseEdges, double baseRadius, double height, vector< TPoint3D > &vec) |
Generates a list of 3D vertices constituting a regular polygon, appending it to an existing vector. | |
static void | generateShiftedBase (uint32_t numBaseEdges, double baseRadius, double height, double shift, vector< TPoint3D > &vec) |
Generates a list of 3D vertices constituting a regular polygon conveniently shifted, appending it to an existing vector. | |
static bool | checkConsistence (const vector< TPoint3D > &vertices, const vector< TPolyhedronFace > &faces) |
Checks whether a set of faces is suitable for a set of vertices. | |
static CPolyhedronPtr | CreateNoCheck (const vector< TPoint3D > &vertices, const vector< TPolyhedronFace > &faces) |
Creates a polyhedron without checking its correctness. | |
static CPolyhedronPtr | CreateEmpty () |
Creates an empty Polyhedron. |
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). Polyhedra information and models have been gotten from the Wikipedia, http://wikipedia.org
Definition at line 50 of file CPolyhedron.h.
mrpt::opengl::CPolyhedron::CPolyhedron | ( | ) | [inline, private] |
mrpt::opengl::CPolyhedron::CPolyhedron | ( | const vector< TPoint3D > & | vertices, | |
const vector< TPolyhedronFace > & | faces, | |||
bool | doCheck = true | |||
) | [inline, private] |
Basic constructor with a list of vertices and another of faces, checking for correctness.
Definition at line 819 of file CPolyhedron.h.
virtual mrpt::opengl::CPolyhedron::~CPolyhedron | ( | ) | [inline, private, virtual] |
void mrpt::opengl::CPolyhedron::addEdges | ( | const TPolyhedronFace & | e | ) | [private] |
Adds, to the existing list of edges, each edge in a given face.
CPolyhedronPtr mrpt::opengl::CPolyhedron::augment | ( | size_t | numVertices, | |
bool | direction = false | |||
) | const |
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.
std::logic_error | a non-regular face has been found. |
CPolyhedronPtr mrpt::opengl::CPolyhedron::augment | ( | bool | direction = false |
) | const |
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.
std::logic_error | a non-regular face has been found. |
CPolyhedronPtr mrpt::opengl::CPolyhedron::augment | ( | double | height, | |
size_t | numVertices | |||
) | const |
Augments a polyhedron to a given height.
This method only affects to faces with certain number of vertices.
CPolyhedronPtr mrpt::opengl::CPolyhedron::augment | ( | double | height | ) | const |
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.
CPolyhedronPtr mrpt::opengl::CPolyhedron::cantellate | ( | double | factor | ) | const |
static bool mrpt::opengl::CPolyhedron::checkConsistence | ( | const vector< TPoint3D > & | vertices, | |
const vector< TPolyhedronFace > & | faces | |||
) | [static, private] |
Checks whether a set of faces is suitable for a set of vertices.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::Create | ( | const std::vector< math::TPolygon3D > & | polys | ) | [static] |
static CPolyhedronPtr mrpt::opengl::CPolyhedron::Create | ( | const vector< TPoint3D > & | vertices, | |
const vector< TPolyhedronFace > & | faces | |||
) | [inline, static] |
Creation of a polyhedron from its vertices and faces.
logic_error | if the polyhedron definition has flaws (bad vertex indices, etc.). |
Definition at line 161 of file CPolyhedron.h.
References mrpt::opengl::CPolyhedron.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::Create | ( | const vector< TPoint3D > & | vertices, | |
const vector< vector< uint32_t > > & | faces | |||
) | [inline, static] |
Creation of a polyhedron from its vertices and faces.
logic_error | if the polyhedron definition has flaws (bad vertex indices, etc.). |
Definition at line 148 of file CPolyhedron.h.
References mrpt::opengl::CPolyhedron::TPolyhedronFace::vertices.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateArchimedeanRegularAntiprism | ( | uint32_t | numBaseEdges, | |
double | baseRadius | |||
) | [inline, static] |
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.
Definition at line 513 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateArchimedeanRegularPrism | ( | uint32_t | numBaseEdges, | |
double | baseRadius | |||
) | [inline, static] |
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.
Definition at line 506 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateBifrustum | ( | const vector< TPoint2D > & | baseVertices, | |
double | height1, | |||
double | ratio1, | |||
double | height2, | |||
double | ratio2 | |||
) | [static] |
Creates a bifrustum, or double truncated pyramid, given a base which will lie on the XY plane.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCatalanDoublePyramid | ( | uint32_t | numBaseEdges, | |
double | height | |||
) | [inline, static] |
Creates a double pyramid whose dual is exactly an archimedean prism.
Creates an octahedron if numBaseEdges is equal to 4.
Definition at line 557 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCatalanTrapezohedron | ( | uint32_t | numBaseEdges, | |
double | height | |||
) | [inline, static] |
Creates a trapezohedron whose dual is exactly an archimedean antiprism.
Creates a cube if numBaseEdges is equal to 3.
Definition at line 549 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCubicPrism | ( | const TPoint3D & | p1, | |
const TPoint3D & | p2 | |||
) | [inline, static] |
Creates a cubic prism, given two opposite vertices.
Definition at line 421 of file CPolyhedron.h.
References mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCubicPrism | ( | double | x1, | |
double | x2, | |||
double | y1, | |||
double | y2, | |||
double | z1, | |||
double | z2 | |||
) | [static] |
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.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCuboctahedron | ( | double | radius | ) | [inline, static] |
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:
Definition at line 245 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCupola | ( | uint32_t | numBaseEdges, | |
double | edgeLength | |||
) | [inline, static] |
Creates a cupola.
std::logic_error | if the number of edges is odd or less than four. |
Definition at line 541 of file CPolyhedron.h.
References M_PI.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCustomAntiprism | ( | const vector< TPoint2D > & | bottomBase, | |
const vector< TPoint2D > & | topBase, | |||
double | height | |||
) | [static] |
Creates a custom antiprism, using two custom bases.
For better results, the top base should be slightly rotated with respect to the bottom one.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateCustomPrism | ( | const vector< TPoint2D > & | baseVertices, | |
double | height | |||
) | [inline, static] |
Creates a custom prism with vertical edges, given any base which will lie on the XY plane.
Definition at line 451 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateDeltoidalHexecontahedron | ( | double | radius | ) | [inline, static] |
Creates a deltoidal hexecontahedron, dual to the rhombicosidodecahedron.
This body consists of 60 kites (see http://en.wikipedia.org/wiki/Deltoidal_hexecontahedron).
Definition at line 403 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateDeltoidalIcositetrahedron | ( | double | radius | ) | [inline, static] |
Creates a deltoidal icositetrahedron, dual to the rhombicuboctahedron.
This body consists of 24 kites (see http://en.wikipedia.org/wiki/Deltoidal_icositetrahedron).
Definition at line 367 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateDodecahedron | ( | double | radius | ) | [inline, static] |
Creates a regular dodecahedron (see http://en.wikipedia.org/wiki/Dodecahedron).
The dodecahedron is created as the dual to an icosahedron.
Definition at line 211 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateDoublePyramid | ( | const vector< TPoint2D > & | baseVertices, | |
double | height1, | |||
double | height2 | |||
) | [static] |
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.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateEmpty | ( | ) | [inline, static, private] |
Creates an empty Polyhedron.
Definition at line 835 of file CPolyhedron.h.
References mrpt::opengl::CPolyhedron.
CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateFrustum | ( | const vector< TPoint2D > & | baseVertices, | |
double | height, | |||
double | ratio | |||
) | [inline] |
This is a synonym for CreateTruncatedPyramid.
Definition at line 444 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateHexahedron | ( | double | radius | ) | [inline, static] |
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:
Definition at line 192 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateIcosahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 219 of file CPolyhedron.h.
References M_PI, and mrpt::utils::square().
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateIcosidodecahedron | ( | double | radius, | |
bool | type = true | |||
) | [inline, static] |
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. The dual of the icosidodecahedron is the rhombic triacontahedron. 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.
Definition at line 280 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateJohnsonSolidWithConstantBase | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
const std::string & | components, | |||
size_t | shifts = 0 | |||
) | [static] |
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. The shape of the body is defined by the string argument, which can include one or more of the following:
String | Body | Restrictions |
P+ | Upward pointing pyramid | Must be the last object, vertex number cannot surpass 5 |
P- | Downward pointing pyramid | Must be the first object, vertex number cannot surpass 5 |
C+ | Upward pointing cupola | Must be the last object, vertex number must be an even number in the range 4-10. |
C- | Downward pointing cupola | Must be the first object, vertex number must be an even number in the range 4-10. |
GC+ | Upward pointing cupola, rotated | Must be the last object, vertex number must be an even number in the range 4-10. |
GC- | Downward pointing cupola, rotated | Must be the first object, vertex number must be an even number in the range 4-10. |
PR | Archimedean prism | Cannot abut other prism |
A | Archimedean antiprism | None |
R+ | Upward pointing rotunda | Must be the last object, vertex number must be exactly 10 |
R- | Downward pointing rotunda | Must be the first object, vertex number must be exactly 10 |
GR+ | Upward pointing rotunda, rotated | Must be the last object, vertex number must be exactly 10 |
GR- | Downward pointing rotunda | Must be the first object, vertex number must be exactly 10 |
String | Vertices | Resulting body |
P+ | 3 | Tetrahedron |
PR | 4 | Hexahedron |
P-P+ | 4 | Octahedron |
A | 3 | Octahedron |
C+PRC- | 8 | Rhombicuboctahedron |
P-AP+ | 5 | Icosahedron |
R-R+ | 10 | Icosidodecahedron |
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateNoCheck | ( | const vector< TPoint3D > & | vertices, | |
const vector< TPolyhedronFace > & | faces | |||
) | [inline, static, private] |
Creates a polyhedron without checking its correctness.
Definition at line 829 of file CPolyhedron.h.
References mrpt::opengl::CPolyhedron.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateOctahedron | ( | double | radius | ) | [inline, static] |
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:
Definition at line 203 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateParallelepiped | ( | const TPoint3D & | base, | |
const TPoint3D & | v1, | |||
const TPoint3D & | v2, | |||
const TPoint3D & | v3 | |||
) | [static] |
Creates a parallelepiped, given a base point and three vectors represented as points.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreatePentagonalRotunda | ( | double | radius | ) | [inline, static] |
Creates a pentagonal rotunda (half an icosidodecahedron), consisting of six pentagons, ten triangles and a decagon (see http://en.wikipedia.org/wiki/Pentagonal_rotunda).
Definition at line 317 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreatePentakisDodecahedron | ( | double | radius | ) | [inline, static] |
Creates a pentakis dodecahedron, dual to the truncated icosahedron.
This body consists of 60 isosceles triangles (see http://en.wikipedia.org/wiki/Pentakis_dodecahedron).
Definition at line 394 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreatePyramid | ( | const vector< TPoint2D > & | baseVertices, | |
double | height | |||
) | [static] |
Creates a custom pyramid, using a set of 2D vertices which will lie on the XY plane.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRandomPolyhedron | ( | double | radius | ) | [static] |
Creates a random polyhedron from the static methods.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularAntiprism | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height | |||
) | [inline, static] |
Creates an antiprism whose base is a regular polygon.
The upper base is rotated with respect to the lower one, where N is the number of vertices in the base, and thus the lateral triangles are isosceles.
Definition at line 478 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularBifrustum | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height1, | |||
double | ratio1, | |||
double | height2, | |||
double | ratio2 | |||
) | [inline, static] |
Creates a bifrustum (double truncated pyramid) whose base is a regular polygon lying in the XY plane.
Definition at line 534 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularDoublePyramid | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height1, | |||
double | height2 | |||
) | [inline, static] |
Creates a regular double pyramid whose base is a regular polygon.
Definition at line 499 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularFrustum | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height, | |||
double | ratio | |||
) | [inline, static] |
This is a synonym for CreateRegularTruncatedPyramid.
Definition at line 527 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularPrism | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height | |||
) | [inline, static] |
Creates a regular prism whose base is a regular polygon and whose edges are either parallel or perpendicular to the XY plane.
Definition at line 485 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularPyramid | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height | |||
) | [inline, static] |
Creates a regular pyramid whose base is a regular polygon.
Definition at line 492 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRegularTruncatedPyramid | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height, | |||
double | ratio | |||
) | [inline, static] |
Creates a regular truncated pyramid whose base is a regular polygon.
Definition at line 520 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRhombicDodecahedron | ( | double | radius | ) | [inline, static] |
Creates a rhombic dodecahedron, dual to the cuboctahedron.
This body consists of 12 rhombi (see http://en.wikipedia.org/wiki/Rhombic_dodecahedron).
Definition at line 340 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRhombicosidodecahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 304 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRhombicTriacontahedron | ( | double | radius | ) | [inline, static] |
Creates a rhombic triacontahedron, dual to the icosidodecahedron.
This body consists of 30 rhombi (see http://en.wikipedia.org/wiki/Rhombic_triacontahedron).
Definition at line 376 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateRhombicuboctahedron | ( | double | radius, | |
bool | type = true | |||
) | [inline, static] |
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. 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.
Definition at line 270 of file CPolyhedron.h.
References M_PI, and mrpt::utils::square().
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTetrahedron | ( | double | radius | ) | [inline, static] |
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. The tetrahedron is the dual to itself.
Definition at line 181 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTetrakisHexahedron | ( | double | radius | ) | [inline, static] |
Creates a tetrakis hexahedron, dual to the truncated octahedron.
This body consists of 24 isosceles triangles (see http://en.wikipedia.org/wiki/Tetrakis_hexahedron).
Definition at line 358 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTrapezohedron | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | basesDistance | |||
) | [static] |
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. When the number of edges equals 3, the polyhedron is actually a parallelepiped, and it can even be a cube.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTriakisIcosahedron | ( | double | radius | ) | [inline, static] |
Creates a triakis icosahedron, dual to the truncated dodecahedron.
This body consists of 60 isosceles triangles http://en.wikipedia.org/wiki/Triakis_icosahedron).
Definition at line 385 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTriakisOctahedron | ( | double | radius | ) | [inline, static] |
Creates a triakis octahedron, dual to the truncated hexahedron.
This body consists of 24 isosceles triangles (see http://en.wikipedia.org/wiki/Triakis_octahedron).
Definition at line 349 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTriakisTetrahedron | ( | double | radius | ) | [inline, static] |
Creates a triakis tetrahedron, dual to the truncated tetrahedron.
This body consists of 12 isosceles triangles (see http://en.wikipedia.org/wiki/Triakis_tetrahedron).
Definition at line 331 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedDodecahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 288 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedHexahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 253 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedIcosahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 296 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedOctahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 261 of file CPolyhedron.h.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedPyramid | ( | const vector< TPoint2D > & | baseVertices, | |
double | height, | |||
double | ratio | |||
) | [static] |
Creates a truncated pyramid, using a set of vertices which will lie on the XY plane.
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.
static CPolyhedronPtr mrpt::opengl::CPolyhedron::CreateTruncatedTetrahedron | ( | double | radius | ) | [inline, static] |
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.
Definition at line 236 of file CPolyhedron.h.
size_t mrpt::opengl::CPolyhedron::edgesInVertex | ( | size_t | vertex | ) | const [private] |
Returns how many edges converge in a given vertex.
size_t mrpt::opengl::CPolyhedron::facesInVertex | ( | size_t | vertex | ) | const [private] |
Returns how many faces converge in a given vertex.
static void mrpt::opengl::CPolyhedron::generateBase | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height, | |||
vector< TPoint3D > & | vec | |||
) | [static, private] |
Generates a list of 3D vertices constituting a regular polygon, appending it to an existing vector.
static vector<TPoint2D> mrpt::opengl::CPolyhedron::generateBase | ( | uint32_t | numBaseEdges, | |
double | baseRadius | |||
) | [static, private] |
Generates a list of 2D vertices constituting a regular polygon.
static void mrpt::opengl::CPolyhedron::generateShiftedBase | ( | uint32_t | numBaseEdges, | |
double | baseRadius, | |||
double | height, | |||
double | shift, | |||
vector< TPoint3D > & | vec | |||
) | [static, private] |
Generates a list of 3D vertices constituting a regular polygon conveniently shifted, appending it to an existing vector.
static vector<TPoint2D> mrpt::opengl::CPolyhedron::generateShiftedBase | ( | uint32_t | numBaseEdges, | |
double | baseRadius | |||
) | [static, private] |
Generates a list of 2D vertices constituting a regular polygon, with an angle shift which makes it suitable for antiprisms.
void mrpt::opengl::CPolyhedron::getCenter | ( | TPoint3D & | center | ) | const |
Gets the center of the polyhedron.
CPolyhedronPtr mrpt::opengl::CPolyhedron::getDual | ( | ) | const |
Given a polyhedron, creates its dual.
std::logic_error | Can't get the dual to this polyhedron. |
void mrpt::opengl::CPolyhedron::getEdges | ( | vector< TPolyhedronEdge > & | edges | ) | const [inline] |
void mrpt::opengl::CPolyhedron::getEdgesLength | ( | vector< double > & | lengths | ) | const |
Gets a vector with each edge's length.
void mrpt::opengl::CPolyhedron::getFaces | ( | vector< TPolyhedronFace > & | faces | ) | const [inline] |
void mrpt::opengl::CPolyhedron::getFacesArea | ( | vector< double > & | areas | ) | const |
Gets a vector with each face's area.
Won't work properly if the polygons are not convex.
static size_t mrpt::opengl::CPolyhedron::getIntersection | ( | const CPolyhedronPtr & | p1, | |
const CPolyhedronPtr & | p2, | |||
T & | container | |||
) | [inline, static] |
Gets the intersection of two polyhedra, either as a set or as a matrix of intersections.
Each intersection is represented by a TObject3D.
Definition at line 690 of file CPolyhedron.h.
References mrpt::math::intersect().
double mrpt::opengl::CPolyhedron::getLineWidth | ( | ) | const [inline] |
uint32_t mrpt::opengl::CPolyhedron::getNumberOfEdges | ( | ) | const [inline] |
uint32_t mrpt::opengl::CPolyhedron::getNumberOfFaces | ( | ) | const [inline] |
uint32_t mrpt::opengl::CPolyhedron::getNumberOfVertices | ( | ) | const [inline] |
void mrpt::opengl::CPolyhedron::getSetOfPolygons | ( | std::vector< math::TPolygon3D > & | vec | ) | const |
void mrpt::opengl::CPolyhedron::getSetOfPolygonsAbsolute | ( | std::vector< math::TPolygon3D > & | vec | ) | const |
Gets the polyhedron as a set of polygons, with the pose transformation already applied.
void mrpt::opengl::CPolyhedron::getVertices | ( | vector< TPoint3D > & | vertices | ) | const [inline] |
double mrpt::opengl::CPolyhedron::getVolume | ( | ) | const |
Gets the polyhedron volume.
Won't work properly if the polyhedron is not convex.
bool mrpt::opengl::CPolyhedron::isClosed | ( | ) | const [inline] |
Returns true if the polygon is a completely closed object.
Definition at line 699 of file CPolyhedron.h.
bool mrpt::opengl::CPolyhedron::isWireframe | ( | ) | const [inline] |
Returns whether the polyhedron will be rendered as a wireframe object.
Definition at line 655 of file CPolyhedron.h.
void mrpt::opengl::CPolyhedron::makeConvexPolygons | ( | ) |
Recomputes polygons, if necessary, so that each one is convex.
void mrpt::opengl::CPolyhedron::render | ( | ) | const [virtual] |
CPolyhedronPtr mrpt::opengl::CPolyhedron::rotate | ( | double | angle | ) | const |
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.
CPolyhedronPtr mrpt::opengl::CPolyhedron::scale | ( | double | factor | ) | const |
Scales a polyhedron to a given factor.
std::logic_error | factor is not a strictly positive number. |
void mrpt::opengl::CPolyhedron::setLineWidth | ( | double | lineWidth | ) | [inline] |
Sets the width used to render lines, when wireframe rendering is activated.
Definition at line 673 of file CPolyhedron.h.
bool mrpt::opengl::CPolyhedron::setNormal | ( | TPolyhedronFace & | f, | |
bool | doCheck = true | |||
) | [private] |
Calculates the normal vector to a face.
void mrpt::opengl::CPolyhedron::setWireframe | ( | bool | enabled = true |
) | [inline] |
Sets whether the polyhedron will be rendered as a wireframe object.
Definition at line 661 of file CPolyhedron.h.
virtual bool mrpt::opengl::CPolyhedron::traceRay | ( | const mrpt::poses::CPose3D & | o, | |
double & | dist | |||
) | const [virtual] |
CPolyhedronPtr mrpt::opengl::CPolyhedron::truncate | ( | double | factor | ) | const |
Truncates a polyhedron to a given factor.
std::logic_error | Polyhedron truncation results in skew polygons and thus it's impossible to perform. |
void mrpt::opengl::CPolyhedron::updatePolygons | ( | ) | const |
Updates the mutable list of polygons used in rendering and ray tracing.
vector<TPolyhedronEdge> mrpt::opengl::CPolyhedron::mEdges [protected] |
vector<TPolyhedronFace> mrpt::opengl::CPolyhedron::mFaces [protected] |
double mrpt::opengl::CPolyhedron::mLineWidth [protected] |
When displaying as wireframe object, this variable stores the width of the edges.
Definition at line 134 of file CPolyhedron.h.
vector<TPoint3D> mrpt::opengl::CPolyhedron::mVertices [protected] |
bool mrpt::opengl::CPolyhedron::mWireframe [protected] |
This flag determines whether the polyhedron will be displayed as a solid object or as a set of edges.
Definition at line 130 of file CPolyhedron.h.
bool mrpt::opengl::CPolyhedron::polygonsUpToDate [mutable, protected] |
Whether the set of actual polygons is up to date or not.
Definition at line 142 of file CPolyhedron.h.
std::vector<TPolygonWithPlane> mrpt::opengl::CPolyhedron::tempPolygons [mutable, protected] |
Mutable list of actual polygons, maintained for speed.
Definition at line 138 of file CPolyhedron.h.
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:10:56 EDT 2009 |