47 const double qr =
x.quat().r();
48 const double qx =
x.quat().x();
49 const double qx2 =
square(qx);
50 const double qy =
x.quat().y();
51 const double qy2 =
square(qy);
52 const double qz =
x.quat().z();
53 const double qz2 =
square(qz);
55 const double ax = u.
x();
56 const double ay = u.
y();
57 const double az = u.z();
58 const double q2r = u.
quat().
r();
59 const double q2x = u.
quat().
x();
60 const double q2y = u.
quat().
y();
61 const double q2z = u.
quat().
z();
68 x.quat().normalizationJacobian(norm_jacob_x);
74 df_dx.set_unsafe(0, 0, 1);
75 df_dx.set_unsafe(1, 1, 1);
76 df_dx.set_unsafe(2, 2, 1);
79 const double vals2[3 * 4] = {2 * (-qz * ay + qy * az),
80 2 * (qy * ay + qz * az),
81 2 * (-2 * qy * ax + qx * ay + qr * az),
82 2 * (-2 * qz * ax - qr * ay + qx * az),
84 2 * (qz * ax - qx * az),
85 2 * (qy * ax - 2 * qx * ay - qr * az),
86 2 * (qx * ax + qz * az),
87 2 * (qr * ax - 2 * qz * ay + qy * az),
89 2 * (-qy * ax + qx * ay),
90 2 * (qz * ax + qr * ay - 2 * qx * az),
91 2 * (-qr * ax + qz * ay - 2 * qy * az),
92 2 * (qx * ax + qy * ay)};
95 df_dx.block(0, 3, 3, 4).noalias() =
101 q2r, -q2x, -q2y, -q2z, q2x, q2r, q2z, -q2y,
102 q2y, -q2z, q2r, q2x, q2z, q2y, -q2x, q2r};
104 df_dx.block(3, 3, 4, 4).noalias() =
112 df_du.set_unsafe(0, 0, 1 - 2 * (qy2 + qz2));
113 df_du.set_unsafe(0, 1, 2 * (qx * qy - qr * qz));
114 df_du.set_unsafe(0, 2, 2 * (qr * qy + qx * qz));
116 df_du.set_unsafe(1, 0, 2 * (qr * qz + qx * qy));
117 df_du.set_unsafe(1, 1, 1 - 2 * (qx2 + qz2));
118 df_du.set_unsafe(1, 2, 2 * (qy * qz - qr * qx));
120 df_du.set_unsafe(2, 0, 2 * (qx * qz - qr * qy));
121 df_du.set_unsafe(2, 1, 2 * (qr * qx + qy * qz));
122 df_du.set_unsafe(2, 2, 1 - 2 * (qx2 + qy2));
127 qr, -qx, -qy, -qz, qx, qr, -qz, qy,
128 qy, qz, qr, -qx, qz, -qy, qx, qr};
130 df_du.block(3, 3, 4, 4).noalias() =
134 if (out_x_oplus_u) *out_x_oplus_u = x_plus_u;
mrpt::math::CQuaternionDouble & quat()
Read/Write access to the quaternion representing the 3D rotation.
double x() const
Common members of all points & poses classes.
#define MRPT_MAX_ALIGN_BYTES
T y() const
Return y coordinate of the quaternion.
GLdouble GLdouble GLdouble GLdouble q
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
T square(const T x)
Inline function for the square of a number.
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
T r() const
Return r coordinate of the quaternion.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
T x() const
Return x coordinate of the quaternion.
void normalizationJacobian(MATRIXLIKE &J) const
Calculate the 4x4 Jacobian of the normalization operation of this quaternion.
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
static void jacobiansPoseComposition(const CPose3DQuat &x, const CPose3DQuat &u, mrpt::math::CMatrixDouble77 &df_dx, mrpt::math::CMatrixDouble77 &df_du, CPose3DQuat *out_x_oplus_u=nullptr)
This static method computes the two Jacobians of a pose composition operation $f(x,u)= x u$.
T z() const
Return z coordinate of the quaternion.
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE( class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...