43 template <
class DERIVEDCLASS>
53 template <
class OTHERCLASS>
57 for (
int i=0;i<dims;i++)
58 static_cast<DERIVEDCLASS*>(
this)->m_coords[i]+=
static_cast<const OTHERCLASS*
>(&b)->m_coords[i];
65 static_cast<DERIVEDCLASS*>(
this)->m_coords[i] *= s;
73 v[i] = static_cast<const DERIVEDCLASS*>(
this)->m_coords[i];
84 out_HM.get_unsafe(0,3)=
static_cast<const DERIVEDCLASS*
>(
this)->
x();
85 out_HM.get_unsafe(1,3)=
static_cast<const DERIVEDCLASS*
>(
this)->
y();
86 if (DERIVEDCLASS::is3DPoseOrPoint())
87 out_HM.get_unsafe(2,3)=
static_cast<const DERIVEDCLASS*
>(
this)->m_coords[2];
95 s = (DERIVEDCLASS::is3DPoseOrPoint()) ?
96 mrpt::format(
"[%f %f]", static_cast<const DERIVEDCLASS*>(
this)->x(),
static_cast<const DERIVEDCLASS*
>(
this)->
y()) :
97 mrpt::format(
"[%f %f %f]",static_cast<const DERIVEDCLASS*>(
this)->x(),
static_cast<const DERIVEDCLASS*
>(
this)->
y(),
static_cast<const DERIVEDCLASS*
>(
this)->m_coords[2]);
108 if (!m.fromMatlabStringFormat(s))
THROW_EXCEPTION(
"Malformed expression in ::fromString");
112 static_cast<DERIVEDCLASS*>(
this)->m_coords[i] = m.get_unsafe(0,i);
115 inline const double &
operator[](
unsigned int i)
const {
return static_cast<const DERIVEDCLASS*
>(
this)->m_coords[i]; }
116 inline double &
operator[](
unsigned int i) {
return static_cast<DERIVEDCLASS*
>(
this)->m_coords[i]; }
123 template <
class DERIVEDCLASS>
124 std::ostream &operator << (std::ostream& o, const CPoint<DERIVEDCLASS>& p)
126 o <<
"(" << p[0] <<
"," << p[1];
127 if (p.is3DPoseOrPoint()) o <<
"," << p[2];
133 template <
class DERIVEDCLASS>
136 if (a.x()<b.x())
return true;
139 if (!a.is3DPoseOrPoint())
141 else if (a.y()<b.y())
143 else return a[2]<b[2];
147 template <
class DERIVEDCLASS>
151 if (p1[i]!=p2[i])
return false;
155 template <
class DERIVEDCLASS>
159 if (p1[i]!=p2[i])
return true;