39 throw std::logic_error(
"Too many dimensions");
47 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts)
49 for (
const auto& obj : objs)
50 if (obj.isPoint()) pnts.push_back(obj.data.point);
53 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms)
55 for (
const auto& obj : objs)
56 if (obj.isSegment()) sgms.push_back(obj.data.segment);
59 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins)
61 for (
const auto& obj : objs)
62 if (obj.isLine()) lins.push_back(obj.data.line);
65 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns)
67 for (
const auto& obj : objs)
68 if (obj.isPlane()) plns.push_back(obj.data.plane);
71 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys)
73 for (
const auto& obj : objs)
74 if (obj.isPolygon()) polys.push_back(*(obj.data.polygon));
77 const std::vector<TObject3D>& objs, std::vector<TPoint3D>& pnts,
78 std::vector<TObject3D>& remainder)
80 for (
const auto& obj : objs)
82 pnts.push_back(obj.data.point);
84 remainder.push_back(obj);
87 const std::vector<TObject3D>& objs, std::vector<TSegment3D>& sgms,
88 std::vector<TObject3D>& remainder)
90 for (
const auto& obj : objs)
92 sgms.push_back(obj.data.segment);
94 remainder.push_back(obj);
97 const std::vector<TObject3D>& objs, std::vector<TLine3D>& lins,
98 std::vector<TObject3D>& remainder)
100 for (
const auto& obj : objs)
102 lins.push_back(obj.data.line);
104 remainder.push_back(obj);
107 const std::vector<TObject3D>& objs, std::vector<TPlane>& plns,
108 std::vector<TObject3D>& remainder)
110 for (
const auto& obj : objs)
112 plns.push_back(obj.data.plane);
114 remainder.push_back(obj);
117 const std::vector<TObject3D>& objs, std::vector<TPolygon3D>& polys,
118 std::vector<TObject3D>& remainder)
120 for (
const auto& obj : objs)
122 polys.push_back(*(obj.data.polygon));
124 remainder.push_back(obj);
132 switch (static_cast<unsigned char>(type))
175 throw std::logic_error(
176 "Unknown TObject3D type found while reading stream");
static void getPolygons(const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys)
Static method to retrieve every polygon included in a vector of objects.
TPoint2D_< double > TPoint2D
Lightweight 2D point.
static constexpr unsigned char GEOMETRIC_TYPE_POLYGON
Object type identifier for TPolygon2D or TPolygon3D.
bool getSegment(TSegment3D &s) const
Gets the content as a segment, returning false if the type is not adequate.
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.
Standard type for storing any lightweight 2D type.
static constexpr unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D.
bool getPlane(TPlane &p) const
Gets the content as a plane, returning false if the type is not adequate.
Standard object for storing any 3D lightweight object.
void generate2DObject(TObject2D &obj) const
Projects into 2D space.
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, CMatrixD::Ptr &pObj)
static constexpr unsigned char GEOMETRIC_TYPE_PLANE
Object type identifier for TPlane.
bool getPolygon(TPolygon3D &p) const
Gets the content as a polygon, returning false if the type is not adequate.
This base provides a set of functions for maths stuff.
2D segment, consisting of two points.
3D segment, consisting of two points.
3D Plane, represented by its equation
static constexpr unsigned char GEOMETRIC_TYPE_UNDEFINED
Object type identifier for empty TObject2D or TObject3D.
bool getPoint(TPoint3D &p) const
Gets the content as a point, returning false if the type is not adequate.
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &s, const CVectorFloat &a)
unsigned char type
Object type identifier.
struct mrpt::math::TObject3D::tobject3d_data_t data
bool getLine(TLine3D &r) const
Gets the content as a line, returning false if the type is not adequate.
static void getPoints(const std::vector< TObject3D > &objs, std::vector< TPoint3D > &pnts)
Static method to retrieve every point included in a vector of objects.
unsigned char getType() const
Gets object type.
static constexpr unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D.
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 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 .