18 #include <Eigen/Dense>    22 static_assert(std::is_trivially_copyable_v<TPose3D>);
    25     : x(p.x), y(p.y), z(0.0), yaw(0.0), 
pitch(0.0), 
roll(0.0)
    29     : x(p.x), y(p.y), z(0.0), yaw(p.phi), 
pitch(0.0), 
roll(0.0)
    33     : x(p.x), y(p.y), z(p.z), yaw(0.0), 
pitch(0.0), 
roll(0.0)
    48     const double cy = cos(
yaw * 0.5), sy = sin(
yaw * 0.5);
    49     const double cp = cos(
pitch * 0.5), sp = sin(
pitch * 0.5);
    50     const double cr = cos(
roll * 0.5), sr = sin(
roll * 0.5);
    52     const double ccc = cr * cp * cy;
    53     const double ccs = cr * cp * sy;
    54     const double css = cr * sp * sy;
    55     const double sss = sr * sp * sy;
    56     const double scc = sr * cp * cy;
    57     const double ssc = sr * sp * cy;
    58     const double csc = cr * sp * cy;
    59     const double scs = sr * cp * sy;
    72         alignas(MRPT_MAX_STATIC_ALIGN_BYTES) 
const double nums[4 * 3] = {
    73             -0.5 * q[3], 0.5 * (-csc + scs), -0.5 * q[1],
    74             -0.5 * q[2], 0.5 * (-ssc - ccs), 0.5 * q[0],
    75             0.5 * q[1],  0.5 * (ccc - sss),  0.5 * q[3],
    76             0.5 * q[0],  0.5 * (-css - scc), -0.5 * q[2]};
    85     res.
x = 
R(0, 0) * l.
x + 
R(0, 1) * l.
y + 
R(0, 2) * l.
z + this->
x;
    86     res.
y = 
R(1, 0) * l.
x + 
R(1, 1) * l.
y + 
R(1, 2) * l.
z + this->
y;
    87     res.
z = 
R(2, 0) * l.
x + 
R(2, 1) * l.
y + 
R(2, 2) * l.
z + this->
z;
   103     res.
x = H(0, 0) * g.
x + H(0, 1) * g.
y + H(0, 2) * g.
z + H(0, 3);
   104     res.
y = H(1, 0) * g.
x + H(1, 1) * g.
y + H(1, 2) * g.
z + H(1, 3);
   105     res.
z = H(2, 0) * g.
x + H(2, 1) * g.
y + H(2, 2) * g.
z + H(2, 3);
   118     const double cy = cos(
yaw);
   119     const double sy = sin(
yaw);
   120     const double cp = cos(
pitch);
   121     const double sp = sin(
pitch);
   122     const double cr = cos(
roll);
   123     const double sr = sin(
roll);
   125     alignas(MRPT_MAX_STATIC_ALIGN_BYTES)
   126         const double rot_vals[] = {cy * cp,
   127                                    cy * sp * sr - sy * cr,
   128                                    cy * sp * cr + sy * sr,
   130                                    sy * sp * sr + cy * cr,
   131                                    sy * sp * cr - cy * sr,
   135     R.loadFromArray(rot_vals);
   145         "Homogeneous matrix is not orthogonal & normalized!: " +
   151         "Homogeneous matrix is not orthogonal & normalized!: " +
   157         "Homogeneous matrix is not orthogonal & normalized!: " +
   161     pitch = atan2(-
R(2, 0), hypot(
R(0, 0), 
R(1, 0)));
   164     if ((fabs(
R(2, 1)) + fabs(
R(2, 2))) <
   165         10 * std::numeric_limits<double>::epsilon())
   189             yaw = atan2(
R(1, 2), 
R(0, 2));
   191             yaw = atan2(-
R(1, 2), -
R(0, 2));
   195         roll = atan2(
R(2, 1), 
R(2, 2));
   197         yaw = atan2(
R(1, 0), 
R(0, 0));
   221     HG.
block<3, 3>(0, 0) = 
R.asEigen();
   225     HG(3, 0) = HG(3, 1) = HG(3, 2) = 0.;
   240         m.
rows() == 1 && m.
cols() == 6, 
"Wrong size of vector in ::fromString");
 std::vector< T1 > operator-(const std::vector< T1 > &v1, const std::vector< T2 > &v2)
 
CMatrixFixed< Scalar, BLOCK_ROWS, BLOCK_COLS > blockCopy(int start_row=0, int start_col=0) const
const blockCopy(): Returns a copy of the given block 
 
A compile-time fixed-size numeric matrix container. 
 
#define THROW_EXCEPTION(msg)
 
std::string std::string format(std::string_view fmt, ARGS &&... args)
 
double roll
Roll coordinate (rotation angle over X coordinate). 
 
T y() const
Return y coordinate of the quaternion. 
 
mrpt::math::CMatrixDouble33 getRotationMatrix() const
 
void fromHomogeneousMatrix(const mrpt::math::CMatrixDouble44 &HG)
 
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &HG) const
 
double yaw
Yaw coordinate (rotation angle over Z axis). 
 
std::optional< std::reference_wrapper< T > > optional_ref
Shorter name for std::optional<std::reference_wrapper<T>> 
 
mrpt::math::CMatrixDouble44 getHomogeneousMatrix() const
 
void loadFromArray(const VECTOR &vals)
 
CMatrixFixed< double, 3, 3 > CMatrixDouble33
 
This base provides a set of functions for maths stuff. 
 
void composePose(const TPose3D other, TPose3D &result) const
 
constexpr double DEG2RAD(const double x)
Degrees to radians. 
 
auto block(int start_row, int start_col)
non-const block(): Returns an Eigen::Block reference to the block 
 
constexpr TPose3D()=default
Default fast constructor. 
 
void composePoint(const TPoint3D &l, TPoint3D &g) const
 
void getAsQuaternion(mrpt::math::CQuaternion< double > &q, mrpt::optional_ref< mrpt::math::CMatrixFixed< double, 4, 3 >> out_dq_dr=std::nullopt) const
Returns the quaternion associated to the rotation of this object (NOTE: XYZ translation is ignored)  ...
 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
 
bool fromMatlabStringFormat(const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must st...
 
size_type rows() const
Number of rows in the matrix. 
 
size_type cols() const
Number of columns in the matrix. 
 
double pitch
Pitch coordinate (rotation angle over Y axis). 
 
static void SO3_to_yaw_pitch_roll(const mrpt::math::CMatrixDouble33 &R, double &yaw, double &pitch, double &roll)
 
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
 
return_t square(const num_t x)
Inline function for the square of a number. 
 
#define ASSERTDEBMSG_(f, __ERROR_MSG)
 
T x() const
Return x coordinate of the quaternion. 
 
void homogeneousMatrixInverse(const MATRIXLIKE1 &M, MATRIXLIKE2 &out_inverse_M)
Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part...
 
void getInverseHomogeneousMatrix(mrpt::math::CMatrixDouble44 &HG) const
 
constexpr double RAD2DEG(const double x)
Radians to degrees. 
 
mrpt::math::CMatrixDouble44 getInverseHomogeneousMatrix() const
 
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates). 
 
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object. 
 
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ...
 
void inverseComposePoint(const TPoint3D &g, TPoint3D &l) const
 
T z() const
Return z coordinate of the quaternion. 
 
std::string asString() const
 
CMatrixFixed< double, 4, 4 > CMatrixDouble44
 
T w() const
Return w (real part) coordinate of the quaternion.