Class TPolygon3D
Defined in File TPolygon3D.h
Inheritance Relationships
Base Type
public std::vector< TPoint3D >
Class Documentation
-
class TPolygon3D : public std::vector<TPoint3D>
3D polygon, inheriting from std::vector<TPoint3D>
See also
Public Functions
-
inline TPolygon3D()
Default constructor. Creates a polygon with no vertices.
-
inline explicit TPolygon3D(size_t N)
Constructor for a given size. Creates a polygon with a fixed number of vertices (uninitialized)
-
explicit TPolygon3D(const TPolygon2D &p)
Constructor from a 2D object. Zeroes the z.
-
inline TPolygon3D(const std::initializer_list<TPoint3D> &&vertices)
Static method to create a regular polygon, given its size and radius.
- Throws:
std::logic_error – if number of edges is less than three, or radius is near zero. Constructor from list of vertices data, for example:
const mrpt::math::TPolygon3D p = { {-6.0, 0.5, 0.0}, {8.0, 2.0, 1.0}, {10.0, 4.0, 2.0} };
-
mrpt::containers::yaml asYAML() const
Returns a YAML representation of the polygon as a sequence (vertices) of sequences (
[x y z]coordinates).See also
Note
User must include
#include <mrpt/containers/yaml.h>if using this method, only a forward declaration is defined here to speed up compilationNote
(New in MRPT 2.4.1)
-
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.
-
void getAsSegmentList(std::vector<TSegment3D> &v) const
Gets as set of segments, instead of set of points.
-
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.
-
void getBestFittingPlane(TPlane &p) const
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.
See also
-
void generate2DObject(TPolygon2D &p) const
Projects into a 2D space, discarding the z.
-
bool isSkew() const
Check whether the polygon is skew. Returns true if there doesn’t exist a plane in which the polygon can fit.
See also
-
void removeRepeatedVertices()
Remove polygon’s repeated vertices.
-
void removeRedundantVertices()
Erase every redundant vertex, thus saving space.
Public Static Functions
-
static TPolygon3D FromYAML(const mrpt::containers::yaml &c)
Builds a polygon from a YAML sequence (vertices) of sequences (
[x y z]coordinates).See also
Note
User must include
#include <mrpt/containers/yaml.h>if using this method, only a forward declaration is defined here to speed up compilationNote
(New in MRPT 2.4.1)
-
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly)
-
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly, const mrpt::math::TPose3D &pose)
Static method to create a regular polygon, given its size and radius. The center will be located on the given pose.
- Throws:
std::logic_error – if number of edges is less than three, or radius is near zero.
-
inline TPolygon3D()