class mrpt::math::CPolygon
Python API: mrpt.math.CPolygon
Overview
A wrapper of a TPolygon2D class, implementing CSerializable.
#include <mrpt/math/CPolygon.h> class CPolygon: public mrpt::serialization::CSerializable, public mrpt::math::TPolygon2D { public: // typedefs typedef std::shared_ptr<mrpt::math ::CPolygon> Ptr; typedef std::shared_ptr<const mrpt::math ::CPolygon> ConstPtr; typedef std::unique_ptr<mrpt::math ::CPolygon> UniquePtr; typedef std::unique_ptr<const mrpt::math ::CPolygon> ConstUniquePtr; // fields static constexpr const char* className = "mrpt::math" "::" "CPolygon"; // construction CPolygon(); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; void add_vertex(double x, double y); double get_vertex_x(size_t i) const; double get_vertex_y(size_t i) const; void set_vertices(const std::vector<double>& x, const std::vector<double>& y); void set_vertices(size_t nVertices, const double* xs, const double* ys); void set_vertices(size_t nVertices, const float* xs, const float* ys); void get_vertices(std::vector<double>& x, std::vector<double>& y) const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::unique_ptr<CObject> UniquePtr; typedef std::unique_ptr<const CObject> ConstUniquePtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; // methods mrpt::rtti::CObject::Ptr duplicateGetSmartPtr() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual CObject* clone() const = 0; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); double distance(const TPoint2D& point) const; bool contains(const TPoint2D& point) const; void getAsSegmentList(std::vector<TSegment2D>& v) const; void generate3DObject(TPolygon3D& p) const; void getCenter(TPoint2D& p) const; bool isConvex() const; void removeRepeatedVertices(); void removeRedundantVertices(); void getPlotData(std::vector<double>& x, std::vector<double>& y) const; std::tuple<std::vector<double>, std::vector<double>> getPlotData() const; mrpt::containers::yaml asYAML() const; void getBoundingBox(TPoint2D& min_coords, TPoint2D& max_coords) const; static TPolygon2D FromYAML(const mrpt::containers::yaml& c); static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D& poly); static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D& poly, const mrpt::math::TPose2D& pose);
Typedefs
typedef std::shared_ptr<mrpt::math ::CPolygon> Ptr
A type for the associated smart pointer.
Construction
CPolygon()
Default constructor (empty polygon, 0 vertices)
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
void add_vertex(double x, double y)
Add a new vertex to polygon.
double get_vertex_x(size_t i) const
Methods for accessing the vertices.
See also:
verticesCount
void set_vertices(const std::vector<double>& x, const std::vector<double>& y)
Set all vertices at once.
void set_vertices(size_t nVertices, const double* xs, const double* ys)
Set all vertices at once.
Please use the std::vector version whenever possible unless efficiency is really an issue
void set_vertices(size_t nVertices, const float* xs, const float* ys)
Set all vertices at once.
Please use the std::vector version whenever possible unless efficiency is really an issue
void get_vertices(std::vector<double>& x, std::vector<double>& y) const
Get all vertices at once.