struct mrpt::math::TObject3D

Standard object for storing any 3D lightweight object.

Do not inherit from this class.

See also:

TPoint3D, TSegment3D, TLine3D, TPlane, TPolygon3D

#include <mrpt/math/TObject3D.h>

struct TObject3D
{
    // structs

    struct tobject3d_data_t;

    // construction

    TObject3D(const TPoint3D& p);
    TObject3D(const TSegment3D& s);
    TObject3D(const TLine3D& r);
    TObject3D(const TPolygon3D& p);
    TObject3D(const TPlane& p);
    TObject3D();
    TObject3D(const TObject3D& obj);

    //
methods

    bool isPoint() const;
    bool isSegment() const;
    bool isLine() const;
    bool isPolygon() const;
    bool isPlane() const;
    unsigned char getType() const;
    bool getPoint(TPoint3D& p) const;
    bool getSegment(TSegment3D& s) const;
    bool getLine(TLine3D& r) const;
    bool getPolygon(TPolygon3D& p) const;
    bool getPlane(TPlane& p) const;
    TObject3D& operator = (const TObject3D& obj);
    void operator = (const TPoint3D& p);
    void operator = (const TSegment3D& s);
    void operator = (const TLine3D& l);
    void operator = (const TPolygon3D& p);
    void operator = (const TPlane& p);
    void generate2DObject(TObject2D& obj) const;
    static void getPoints(const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts);
    static void getSegments(const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms);
    static void getLines(const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins);
    static void getPlanes(const std::vector<TObject3D>& objs, std::vector<TPlane>& plns);
    static void getPolygons(const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys);

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

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

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

    static void getPlanes(
        const std::vector<TObject3D>& objs,
        std::vector<TPlane>& plns,
        std::vector<TObject3D>& remainder
        );

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

Construction

TObject3D(const TPoint3D& p)

Constructor from point.

TObject3D(const TSegment3D& s)

Constructor from segment.

TObject3D(const TLine3D& r)

Constructor from line.

TObject3D(const TPolygon3D& p)

Constructor from polygon.

TObject3D(const TPlane& p)

Constructor from plane.

TObject3D()

Empty constructor.

TObject3D(const TObject3D& obj)

Constructs from another object.

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.

bool isPlane() const

Checks whether content is a plane.

unsigned char getType() const

Gets object type.

bool getPoint(TPoint3D& p) const

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

bool getSegment(TSegment3D& s) const

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

bool getLine(TLine3D& r) const

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

bool getPolygon(TPolygon3D& p) const

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

bool getPlane(TPlane& p) const

Gets the content as a plane, returning false if the type is not adequate.

TObject3D& operator = (const TObject3D& obj)

Assigns another object, creating a new pointer if needed.

void operator = (const TPoint3D& p)

Assigns a point to this object.

void operator = (const TSegment3D& s)

Assigns a segment to this object.

void operator = (const TLine3D& l)

Assigns a line to this object.

void operator = (const TPolygon3D& p)

Assigns a polygon to this object.

void operator = (const TPlane& p)

Assigns a plane to this object.

void generate2DObject(TObject2D& obj) const

Projects into 2D space.

Parameters:

std::logic_error

if the 3D object loses its properties when projecting into 2D space (for example, it’s a plane or a vertical line).

static void getPoints(const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts)

Static method to retrieve every point included in a vector of objects.

static void getSegments(const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms)

Static method to retrieve every segment included in a vector of objects.

static void getLines(const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins)

Static method to retrieve every line included in a vector of objects.

static void getPlanes(const std::vector<TObject3D>& objs, std::vector<TPlane>& plns)

Static method to retrieve every plane included in a vector of objects.

static void getPolygons(
    const std::vector<TObject3D>& objs,
    std::vector<TPolygon3D>& polys
    )

Static method to retrieve every polygon included in a vector of objects.

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

Static method to retrieve every point included in a vector of objects, returning the remaining objects in another argument.

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

Static method to retrieve every segment included in a vector of objects, returning the remaining objects in another argument.

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

Static method to retrieve every line included in a vector of objects, returning the remaining objects in another argument.

static void getPlanes(
    const std::vector<TObject3D>& objs,
    std::vector<TPlane>& plns,
    std::vector<TObject3D>& remainder
    )

Static method to retrieve every plane included in a vector of objects, returning the remaining objects in another argument.

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

Static method to retrieve every polygon included in a vector of objects, returning the remaining objects in another argument.