struct mrpt::math::TObject2D

Standard type for storing any lightweight 2D type.

Do not inherit from this class.

See also:

TPoint2D, TSegment2D, TLine2D, TPolygon2D

#include <mrpt/math/TObject2D.h>

struct TObject2D
{
    // structs

    struct tobject2d_data_t;

    // construction

    TObject2D(const TPoint2D& p);
    TObject2D(const TSegment2D& s);
    TObject2D(const TLine2D& r);
    TObject2D(const TPolygon2D& p);
    TObject2D();
    TObject2D(const TObject2D& obj);

    //
methods

    bool isPoint() const;
    bool isSegment() const;
    bool isLine() const;
    bool isPolygon() const;
    unsigned char getType() const;
    bool getPoint(TPoint2D& p) const;
    bool getSegment(TSegment2D& s) const;
    bool getLine(TLine2D& r) const;
    bool getPolygon(TPolygon2D& p) const;
    TObject2D& operator = (const TObject2D& obj);
    void operator = (const TPoint2D& p);
    void operator = (const TSegment2D& s);
    void operator = (const TLine2D& l);
    void operator = (const TPolygon2D& p);
    void generate3DObject(TObject3D& obj) const;
    static void getPoints(const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts);
    static void getSegments(const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms);
    static void getLines(const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins);
    static void getPolygons(const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys);

    static void getPoints(
        const std::vector<TObject2D>& objs,
        std::vector<TPoint2D>& pnts,
        std::vector<TObject2D>& remainder
        );

    static void getSegments(
        const std::vector<TObject2D>& objs,
        std::vector<TSegment2D>& sgms,
        std::vector<TObject2D>& remainder
        );

    static void getLines(
        const std::vector<TObject2D>& objs,
        std::vector<TLine2D>& lins,
        std::vector<TObject2D>& remainder
        );

    static void getPolygons(
        const std::vector<TObject2D>& objs,
        std::vector<TPolygon2D>& polys,
        std::vector<TObject2D>& remainder
        );
};

Construction

TObject2D(const TPoint2D& p)

Implicit constructor from point.

TObject2D(const TSegment2D& s)

Implicit constructor from segment.

TObject2D(const TLine2D& r)

Implicit constructor from line.

TObject2D(const TPolygon2D& p)

Implicit constructor from polygon.

TObject2D()

Implicit constructor from polygon.

TObject2D(const TObject2D& obj)

Constructor from another TObject2D.

Methods

bool isPoint() const

Checks whether content is a point.

bool isSegment() const

Checks whether content is a segment.

bool isLine() const

Checks whether content is a line.

bool isPolygon() const

Checks whether content is a polygon.

unsigned char getType() const

Gets content type.

bool getPoint(TPoint2D& p) const

Gets the content as a point, returning false if the type is inadequate.

bool getSegment(TSegment2D& s) const

Gets the content as a segment, returning false if the type is inadequate.

bool getLine(TLine2D& r) const

Gets the content as a line, returning false if the type is inadequate.

bool getPolygon(TPolygon2D& p) const

Gets the content as a polygon, returning false if the type is inadequate.

TObject2D& operator = (const TObject2D& obj)

Assign another TObject2D.

Pointers are not shared.

void operator = (const TPoint2D& p)

Assign a point to this object.

void operator = (const TSegment2D& s)

Assign a segment to this object.

void operator = (const TLine2D& l)

Assign a line to this object.

void operator = (const TPolygon2D& p)

Assign a polygon to this object.

void generate3DObject(TObject3D& obj) const

Project into 3D space.

static void getPoints(const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts)

Static method to retrieve all the points in a vector of TObject2D.

static void getSegments(const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms)

Static method to retrieve all the segments in a vector of TObject2D.

static void getLines(const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins)

Static method to retrieve all the lines in a vector of TObject2D.

static void getPolygons(
    const std::vector<TObject2D>& objs,
    std::vector<TPolygon2D>& polys
    )

Static method to retrieve all the polygons in a vector of TObject2D.

static void getPoints(
    const std::vector<TObject2D>& objs,
    std::vector<TPoint2D>& pnts,
    std::vector<TObject2D>& remainder
    )

Static method to retrieve all the points in a vector of TObject2D, returning the remainder objects in another parameter.

static void getSegments(
    const std::vector<TObject2D>& objs,
    std::vector<TSegment2D>& sgms,
    std::vector<TObject2D>& remainder
    )

Static method to retrieve all the segments in a vector of TObject2D, returning the remainder objects in another parameter.

static void getLines(
    const std::vector<TObject2D>& objs,
    std::vector<TLine2D>& lins,
    std::vector<TObject2D>& remainder
    )

Static method to retrieve all the lines in a vector of TObject2D, returning the remainder objects in another parameter.

static void getPolygons(
    const std::vector<TObject2D>& objs,
    std::vector<TPolygon2D>& polys,
    std::vector<TObject2D>& remainder
    )

Static method to retrieve all the polygons in a vector of TObject2D, returning the remainder objects in another parameter.