MRPT  2.0.1
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
mrpt::math::TObject2D Struct Reference

Detailed Description

Standard type for storing any lightweight 2D type.

Do not inherit from this class.

See also
TPoint2D,TSegment2D,TLine2D,TPolygon2D

Definition at line 24 of file TObject2D.h.

#include <mrpt/math/TObject2D.h>

Classes

struct  tobject2d_data_t
 Union type storing pointers to every allowed type. More...
 

Public Member Functions

 TObject2D (const TPoint2D &p)
 Implicit constructor from point. More...
 
 TObject2D (const TSegment2D &s)
 Implicit constructor from segment. More...
 
 TObject2D (const TLine2D &r)
 Implicit constructor from line. More...
 
 TObject2D (const TPolygon2D &p)
 Implicit constructor from polygon. More...
 
 TObject2D ()
 Implicit constructor from polygon. More...
 
 ~TObject2D ()
 Object destruction. More...
 
bool isPoint () const
 Checks whether content is a point. More...
 
bool isSegment () const
 Checks whether content is a segment. More...
 
bool isLine () const
 Checks whether content is a line. More...
 
bool isPolygon () const
 Checks whether content is a polygon. More...
 
unsigned char getType () const
 Gets content type. More...
 
bool getPoint (TPoint2D &p) const
 Gets the content as a point, returning false if the type is inadequate. More...
 
bool getSegment (TSegment2D &s) const
 Gets the content as a segment, returning false if the type is inadequate. More...
 
bool getLine (TLine2D &r) const
 Gets the content as a line, returning false if the type is inadequate. More...
 
bool getPolygon (TPolygon2D &p) const
 Gets the content as a polygon, returning false if the type is inadequate. More...
 
TObject2Doperator= (const TObject2D &obj)
 Assign another TObject2D. More...
 
void operator= (const TPoint2D &p)
 Assign a point to this object. More...
 
void operator= (const TSegment2D &s)
 Assign a segment to this object. More...
 
void operator= (const TLine2D &l)
 Assign a line to this object. More...
 
void operator= (const TPolygon2D &p)
 Assign a polygon to this object. More...
 
void generate3DObject (TObject3D &obj) const
 Project into 3D space. More...
 
 TObject2D (const TObject2D &obj)
 Constructor from another TObject2D. More...
 

Static Public Member Functions

static void getPoints (const std::vector< TObject2D > &objs, std::vector< TPoint2D > &pnts)
 Static method to retrieve all the points in a vector of TObject2D. More...
 
static void getSegments (const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms)
 Static method to retrieve all the segments in a vector of TObject2D. More...
 
static void getLines (const std::vector< TObject2D > &objs, std::vector< TLine2D > &lins)
 Static method to retrieve all the lines in a vector of TObject2D. More...
 
static void getPolygons (const std::vector< TObject2D > &objs, std::vector< TPolygon2D > &polys)
 Static method to retrieve all the polygons in a vector of TObject2D. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Private Member Functions

void destroy ()
 Destroys the object, releasing the pointer to the content (if any). More...
 

Private Attributes

unsigned char type {GEOMETRIC_TYPE_UNDEFINED}
 Object type identifier. More...
 
struct mrpt::math::TObject2D::tobject2d_data_t data
 

Constructor & Destructor Documentation

◆ TObject2D() [1/6]

mrpt::math::TObject2D::TObject2D ( const TPoint2D p)
inline

Implicit constructor from point.

Definition at line 56 of file TObject2D.h.

References data, and mrpt::math::TObject2D::tobject2d_data_t::point.

◆ TObject2D() [2/6]

mrpt::math::TObject2D::TObject2D ( const TSegment2D s)
inline

Implicit constructor from segment.

Definition at line 63 of file TObject2D.h.

References data, and mrpt::math::TObject2D::tobject2d_data_t::segment.

◆ TObject2D() [3/6]

mrpt::math::TObject2D::TObject2D ( const TLine2D r)
inline

Implicit constructor from line.

Definition at line 70 of file TObject2D.h.

References data, and mrpt::math::TObject2D::tobject2d_data_t::line.

◆ TObject2D() [4/6]

mrpt::math::TObject2D::TObject2D ( const TPolygon2D p)
inline

Implicit constructor from polygon.

Definition at line 74 of file TObject2D.h.

References data, and mrpt::math::TObject2D::tobject2d_data_t::polygon.

◆ TObject2D() [5/6]

mrpt::math::TObject2D::TObject2D ( )
inline

Implicit constructor from polygon.

Definition at line 81 of file TObject2D.h.

◆ ~TObject2D()

mrpt::math::TObject2D::~TObject2D ( )
inline

Object destruction.

Definition at line 85 of file TObject2D.h.

References destroy().

Here is the call graph for this function:

◆ TObject2D() [6/6]

mrpt::math::TObject2D::TObject2D ( const TObject2D obj)
inline

Constructor from another TObject2D.

Definition at line 227 of file TObject2D.h.

References operator=().

Here is the call graph for this function:

Member Function Documentation

◆ destroy()

void mrpt::math::TObject2D::destroy ( )
inlineprivate

Destroys the object, releasing the pointer to the content (if any).

Definition at line 46 of file TObject2D.h.

References data, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_UNDEFINED, mrpt::math::TObject2D::tobject2d_data_t::polygon, and type.

Referenced by operator=(), and ~TObject2D().

Here is the caller graph for this function:

◆ generate3DObject()

void TObject2D::generate3DObject ( TObject3D obj) const

Project into 3D space.

Definition at line 24 of file TObject2D.cpp.

References data, mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_SEGMENT, mrpt::math::TObject2D::tobject2d_data_t::line, mrpt::math::TObject2D::tobject2d_data_t::point, mrpt::math::TObject2D::tobject2d_data_t::polygon, mrpt::math::TObject2D::tobject2d_data_t::segment, and type.

Referenced by intersect(), and intersectInCommonPlane().

Here is the caller graph for this function:

◆ getLine()

bool mrpt::math::TObject2D::getLine ( TLine2D r) const
inline

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

Definition at line 136 of file TObject2D.h.

References data, isLine(), and mrpt::math::TObject2D::tobject2d_data_t::line.

Referenced by mrpt::math::intersect(), mrpt::math::operator<<(), and mrpt::math::project2D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLines() [1/2]

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

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

Definition at line 57 of file TObject2D.cpp.

◆ getLines() [2/2]

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

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

Definition at line 89 of file TObject2D.cpp.

◆ getPoint()

bool mrpt::math::TObject2D::getPoint ( TPoint2D p) const
inline

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

Definition at line 109 of file TObject2D.h.

References data, isPoint(), and mrpt::math::TObject2D::tobject2d_data_t::point.

Referenced by mrpt::math::getAngleBisector(), mrpt::math::intersect(), intersect(), mrpt::math::operator<<(), mrpt::math::project2D(), mrpt::math::splitInConvexComponents(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPoints() [1/2]

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

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

Definition at line 45 of file TObject2D.cpp.

◆ getPoints() [2/2]

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

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

Definition at line 69 of file TObject2D.cpp.

◆ getPolygon()

bool mrpt::math::TObject2D::getPolygon ( TPolygon2D p) const
inline

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

Definition at line 150 of file TObject2D.h.

References data, isPolygon(), and mrpt::math::TObject2D::tobject2d_data_t::polygon.

Referenced by mrpt::math::intersect(), mrpt::math::operator<<(), and mrpt::math::project2D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPolygons() [1/2]

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

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

Definition at line 63 of file TObject2D.cpp.

◆ getPolygons() [2/2]

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

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

Definition at line 99 of file TObject2D.cpp.

◆ getSegment()

bool mrpt::math::TObject2D::getSegment ( TSegment2D s) const
inline

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

Definition at line 123 of file TObject2D.h.

References data, isSegment(), and mrpt::math::TObject2D::tobject2d_data_t::segment.

Referenced by mrpt::math::intersect(), mrpt::math::operator<<(), and mrpt::math::project2D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSegments() [1/2]

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

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

Definition at line 51 of file TObject2D.cpp.

◆ getSegments() [2/2]

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

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

Definition at line 79 of file TObject2D.cpp.

◆ getType()

unsigned char mrpt::math::TObject2D::getType ( ) const
inline

Gets content type.

Definition at line 105 of file TObject2D.h.

References type.

Referenced by fromObject(), mrpt::math::operator<<(), mrpt::math::project2D(), and TEST().

Here is the caller graph for this function:

◆ isLine()

bool mrpt::math::TObject2D::isLine ( ) const
inline

Checks whether content is a line.

Definition at line 97 of file TObject2D.h.

References mrpt::math::GEOMETRIC_TYPE_LINE, and type.

Referenced by getLine(), mrpt::math::intersect(), and intersect().

Here is the caller graph for this function:

◆ isPoint()

bool mrpt::math::TObject2D::isPoint ( ) const
inline

Checks whether content is a point.

Definition at line 89 of file TObject2D.h.

References mrpt::math::GEOMETRIC_TYPE_POINT, and type.

Referenced by getPoint().

Here is the caller graph for this function:

◆ isPolygon()

bool mrpt::math::TObject2D::isPolygon ( ) const
inline

Checks whether content is a polygon.

Definition at line 101 of file TObject2D.h.

References mrpt::math::GEOMETRIC_TYPE_POLYGON, and type.

Referenced by getPolygon().

Here is the caller graph for this function:

◆ isSegment()

bool mrpt::math::TObject2D::isSegment ( ) const
inline

Checks whether content is a segment.

Definition at line 93 of file TObject2D.h.

References mrpt::math::GEOMETRIC_TYPE_SEGMENT, and type.

Referenced by getSegment().

Here is the caller graph for this function:

◆ operator=() [1/5]

TObject2D& mrpt::math::TObject2D::operator= ( const TObject2D obj)
inline

Assign another TObject2D.

Pointers are not shared.

Definition at line 163 of file TObject2D.h.

References data, destroy(), mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_SEGMENT, mrpt::math::TObject2D::tobject2d_data_t::line, mrpt::math::TObject2D::tobject2d_data_t::point, mrpt::math::TObject2D::tobject2d_data_t::polygon, mrpt::math::TObject2D::tobject2d_data_t::segment, and type.

Referenced by TObject2D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/5]

void mrpt::math::TObject2D::operator= ( const TPoint2D p)
inline

Assign a point to this object.

Definition at line 187 of file TObject2D.h.

References data, destroy(), mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::TObject2D::tobject2d_data_t::point, and type.

Here is the call graph for this function:

◆ operator=() [3/5]

void mrpt::math::TObject2D::operator= ( const TSegment2D s)
inline

Assign a segment to this object.

Definition at line 196 of file TObject2D.h.

References data, destroy(), mrpt::math::GEOMETRIC_TYPE_SEGMENT, mrpt::math::TObject2D::tobject2d_data_t::segment, and type.

Here is the call graph for this function:

◆ operator=() [4/5]

void mrpt::math::TObject2D::operator= ( const TLine2D l)
inline

Assign a line to this object.

Definition at line 205 of file TObject2D.h.

References data, destroy(), mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::TObject2D::tobject2d_data_t::line, and type.

Here is the call graph for this function:

◆ operator=() [5/5]

void mrpt::math::TObject2D::operator= ( const TPolygon2D p)
inline

Assign a polygon to this object.

Definition at line 214 of file TObject2D.h.

References data, destroy(), mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::TObject2D::tobject2d_data_t::polygon, and type.

Here is the call graph for this function:

Member Data Documentation

◆ data

struct mrpt::math::TObject2D::tobject2d_data_t mrpt::math::TObject2D::data
private

◆ type

unsigned char mrpt::math::TObject2D::type {GEOMETRIC_TYPE_UNDEFINED}
private

Object type identifier.

Definition at line 30 of file TObject2D.h.

Referenced by destroy(), generate3DObject(), getType(), isLine(), isPoint(), isPolygon(), isSegment(), and operator=().




Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020