class mrpt::math::TPolygon2D

2D polygon, inheriting from std::vector<TPoint2D>.

See also:

TPolygon3D, TSegment2D, TLine2D, TPoint2D, CPolygon

#include <mrpt/math/TPolygon2D.h>

class TPolygon2D: public std::vector< TPoint2D >
{
public:
    // construction

    TPolygon2D();
    TPolygon2D(size_t N);
    TPolygon2D(const std::vector<TPoint2D>& v);
    TPolygon2D(const std::initializer_list<TPoint2D>&& vertices);
    TPolygon2D(const TPolygon3D& p);

    //
methods

    std::tuple<std::vector<double>, std::vector<double>> getPlotData() const;
};

// direct descendants

class CPolygon;

Construction

TPolygon2D()

Default constructor

TPolygon2D(size_t N)

Constructor for a given number of vertices (uninitialized)

TPolygon2D(const std::vector<TPoint2D>& v)

Implicit constructor from a vector of 2D points.

TPolygon2D(const std::initializer_list<TPoint2D>&& vertices)

Constructor from list of vertices data, for example:

const mrpt::math::TPolygon2D p = {
 {-6.0, 0.5}, {8.0, 2.0}, {10.0, 4.0}
 };
TPolygon2D(const TPolygon3D& p)

Constructor from a 3D object.