3D polygon, inheriting from std::vector<TPoint3D>
Definition at line 1040 of file lightweight_geom_data.h.
#include <mrpt/math/lightweight_geom_data.h>
Public Member Functions | |
double | distance (const TPoint3D &point) const |
Distance to point (always >=0) More... | |
bool | contains (const TPoint3D &point) const |
Check whether a point is inside (or within geometryEpsilon of a polygon edge). This works for concave or convex polygons. More... | |
void | getAsSegmentList (std::vector< TSegment3D > &v) const |
Gets as set of segments, instead of set of points. More... | |
bool | getPlane (TPlane &p) const |
Gets a plane which contains the polygon. Returns false if the polygon is skew and cannot be fit inside a plane. More... | |
void | getBestFittingPlane (TPlane &p) const |
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not. More... | |
void | generate2DObject (TPolygon2D &p) const |
Projects into a 2D space, discarding the z. More... | |
void | getCenter (TPoint3D &p) const |
Get polygon's central point. More... | |
bool | isSkew () const |
Check whether the polygon is skew. Returns true if there doesn't exist a plane in which the polygon can fit. More... | |
void | removeRepeatedVertices () |
Remove polygon's repeated vertices. More... | |
void | removeRedundantVertices () |
Erase every redundant vertex, thus saving space. More... | |
TPolygon3D () | |
Default constructor. More... | |
TPolygon3D (size_t N) | |
Constructor for a given size. More... | |
TPolygon3D (const std::vector< TPoint3D > &v) | |
Implicit constructor from a 3D points vector. More... | |
TPolygon3D (const TPolygon2D &p) | |
Constructor from a 2D object. More... | |
Static Public Member Functions | |
static void | createRegularPolygon (size_t numEdges, double radius, TPolygon3D &poly) |
Static method to create a regular polygon, given its size and radius. More... | |
static void | createRegularPolygon (size_t numEdges, double radius, TPolygon3D &poly, const mrpt::poses::CPose3D &pose) |
Static method to create a regular polygon, given its size and radius. More... | |
Public Attributes | |
T | elements |
STL member. More... | |
|
inline |
Default constructor.
Creates a polygon with no vertices.
Definition at line 1057 of file lightweight_geom_data.h.
|
inlineexplicit |
Constructor for a given size.
Creates a polygon with a fixed number of vertices, which are initialized to garbage.
Definition at line 1059 of file lightweight_geom_data.h.
|
inline |
Implicit constructor from a 3D points vector.
Definition at line 1061 of file lightweight_geom_data.h.
|
explicit |
Constructor from a 2D object.
Zeroes the z.
Definition at line 851 of file lightweight_geom_data.cpp.
References mrpt::math::TPoint3D::size().
bool mrpt::math::TPolygon3D::contains | ( | const TPoint3D & | point | ) | const |
Check whether a point is inside (or within geometryEpsilon of a polygon edge). This works for concave or convex polygons.
Definition at line 805 of file lightweight_geom_data.cpp.
References mrpt::math::TPolygon2D::contains(), mrpt::math::geometryEpsilon, mrpt::math::TPlane::getAsPose3D(), getPlane(), mrpt::math::getPrismBounds(), mrpt::math::project3D(), mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.
Referenced by mrpt::math::intersect().
|
static |
Static method to create a regular polygon, given its size and radius.
std::logic_error | if number of edges is less than three, or radius is near zero. |
Definition at line 856 of file lightweight_geom_data.cpp.
References mrpt::math::geometryEpsilon, and M_PI.
Referenced by createRegularPolygon().
|
inlinestatic |
Static method to create a regular polygon, given its size and radius.
The center will be located on the given pose.
std::logic_error | if number of edges is less than three, or radius is near zero. |
Definition at line 864 of file lightweight_geom_data.cpp.
References mrpt::poses::CPose3D::composePoint(), and createRegularPolygon().
double mrpt::math::TPolygon3D::distance | ( | const TPoint3D & | point | ) | const |
Distance to point (always >=0)
Definition at line 793 of file lightweight_geom_data.cpp.
References mrpt::math::TPolygon2D::distance(), mrpt::math::TPlane::getAsPose3DForcingOrigin(), getPlane(), mrpt::math::project3D(), and mrpt::math::TPoint3D::z.
|
inline |
Projects into a 2D space, discarding the z.
Definition at line 1049 of file lightweight_geom_data.h.
void mrpt::math::TPolygon3D::getAsSegmentList | ( | std::vector< TSegment3D > & | v | ) | const |
Gets as set of segments, instead of set of points.
Definition at line 822 of file lightweight_geom_data.cpp.
References mrpt::math::size(), and mrpt::math::TSegment3D.
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.
Definition at line 831 of file lightweight_geom_data.cpp.
References mrpt::math::getRegressionPlane().
Referenced by mrpt::opengl::CPolyhedron::augment(), and mrpt::math::TPolygonWithPlane::TPolygonWithPlane().
Get polygon's central point.
Definition at line 834 of file lightweight_geom_data.cpp.
References begin(), and mrpt::math::size().
Referenced by mrpt::opengl::CPolyhedron::augment().
bool mrpt::math::TPolygon3D::getPlane | ( | TPlane & | p | ) | const |
Gets a plane which contains the polygon. Returns false if the polygon is skew and cannot be fit inside a plane.
Definition at line 828 of file lightweight_geom_data.cpp.
References mrpt::math::conformAPlane().
Referenced by contains(), distance(), mrpt::math::intersect(), mrpt::opengl::CPolyhedron::setNormal(), and mrpt::math::splitInConvexComponents().
bool mrpt::math::TPolygon3D::isSkew | ( | ) | const |
Check whether the polygon is skew. Returns true if there doesn't exist a plane in which the polygon can fit.
Definition at line 841 of file lightweight_geom_data.cpp.
References mrpt::math::conformAPlane().
void mrpt::math::TPolygon3D::removeRedundantVertices | ( | ) |
Erase every redundant vertex, thus saving space.
Definition at line 847 of file lightweight_geom_data.cpp.
References removeRepeatedVertices(), and mrpt::math::removeUnusedVertices().
void mrpt::math::TPolygon3D::removeRepeatedVertices | ( | ) |
Remove polygon's repeated vertices.
Definition at line 844 of file lightweight_geom_data.cpp.
References mrpt::math::removeRepVertices().
Referenced by removeRedundantVertices().
|
inherited |
STL member.
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |