29 out << m_coords[0] << m_coords[1];
48 in >> m_coords[0] >> m_coords[1];
58 out[
"x"] = m_coords[0];
59 out[
"y"] = m_coords[1];
69 m_coords[0] =
static_cast<double>(
in[
"x"]);
70 m_coords[1] =
static_cast<double>(
in[
"y"]);
83 const double ccos = cos(
b.phi());
84 const double ssin = sin(
b.phi());
85 const double Ax =
x() -
b.x();
86 const double Ay =
y() -
b.y();
88 return CPoint2D(Ax * ccos + Ay * ssin, -Ax * ssin + Ay * ccos);
93 for (
int i = 0; i < 2; i++)
94 m_coords[i] = std::numeric_limits<double>::quiet_NaN();
104 o <<
"(" <<
p[0] <<
"," <<
p[1] <<
")";
double x
X,Y,Z coordinates.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
std::ostream & operator<<(std::ostream &o, const CPoint2D &p)
Dumps a point as a string (x,y)
Virtual base class for "schematic archives" (JSON, XML,...)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
CPoint2D(double x=0, double y=0)
Constructor for initializing point coordinates.
A class used to store a 2D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods.
void setToNaN() override
Set all data fields to quiet NaN.
Virtual base class for "archives": classes abstracting I/O streams.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
CPoint2D operator-(const CPose2D &b) const
The operator D="this"-b is the pose inverse compounding operator, the resulting points "D" fulfils: "...
mrpt::math::TPoint2D asTPoint() const
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.