46 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts)
48 for (
const auto& obj : objs)
49 if (obj.isPoint()) pnts.push_back(obj.data.point);
52 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms)
54 for (
const auto& obj : objs)
55 if (obj.isSegment()) sgms.push_back(obj.data.segment);
58 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins)
60 for (
const auto& obj : objs)
61 if (obj.isLine()) lins.push_back(obj.data.line);
64 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys)
66 for (
const auto& obj : objs)
67 if (obj.isPolygon()) polys.push_back(*(obj.data.polygon));
70 const std::vector<TObject2D>& objs, std::vector<TPoint2D>& pnts,
71 std::vector<TObject2D>& remainder)
73 for (
const auto& obj : objs)
75 pnts.push_back(obj.data.point);
77 remainder.push_back(obj);
80 const std::vector<TObject2D>& objs, std::vector<TSegment2D>& sgms,
81 std::vector<TObject2D>& remainder)
83 for (
const auto& obj : objs)
85 sgms.push_back(obj.data.segment);
87 remainder.push_back(obj);
90 const std::vector<TObject2D>& objs, std::vector<TLine2D>& lins,
91 std::vector<TObject2D>& remainder)
93 for (
const auto& obj : objs)
95 lins.push_back(obj.data.line);
97 remainder.push_back(obj);
100 const std::vector<TObject2D>& objs, std::vector<TPolygon2D>& polys,
101 std::vector<TObject2D>& remainder)
103 for (
const auto& obj : objs)
105 polys.push_back(*(obj.data.polygon));
107 remainder.push_back(obj);
115 switch (static_cast<unsigned char>(type))
151 throw std::logic_error(
152 "Unknown TObject2D type found while reading stream");
bool getPoint(TPoint2D &p) const
Gets the content as a point, 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.
unsigned char getType() const
Gets content type.
static constexpr unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
static void getLines(const std::vector< TObject2D > &objs, std::vector< TLine2D > &lins)
Static method to retrieve all the lines in a vector of TObject2D.
Standard type for storing any lightweight 2D type.
bool getLine(TLine2D &r) const
Gets the content as a line, returning false if the type is inadequate.
static constexpr unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
Standard object for storing any 3D lightweight object.
bool getSegment(TSegment2D &s) const
Gets the content as a segment, returning false if the type is inadequate.
static void getSegments(const std::vector< TObject2D > &objs, std::vector< TSegment2D > &sgms)
Static method to retrieve all the segments in a vector of TObject2D.
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, CMatrixD::Ptr &pObj)
This base provides a set of functions for maths stuff.
2D segment, consisting of two points.
struct mrpt::math::TObject2D::tobject2d_data_t data
3D segment, consisting of two points.
void generate3DObject(TObject3D &obj) const
Project into 3D space.
TPoint3D_< double > TPoint3D
Lightweight 3D point.
unsigned char type
Object type identifier.
static constexpr unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
Virtual base class for "archives": classes abstracting I/O streams.
static void getPoints(const std::vector< TObject2D > &objs, std::vector< TPoint2D > &pnts)
Static method to retrieve all the points in a vector of TObject2D.
mrpt::vision::TStereoCalibResults out
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &s, const CVectorFloat &a)
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 constexpr unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
static constexpr unsigned char GEOMETRIC_TYPE_LINE
Object type identifier for TLine2D or TLine3D.
2D polygon, inheriting from std::vector<TPoint2D>.
3D polygon, inheriting from std::vector<TPoint3D>
3D line, represented by a base point and a director vector.
2D line without bounds, represented by its equation .