25 #ifndef INCLUDED_ExternalQuaternion_h_GUID_3235DD66_A6E6_47BD_7CC0_51BBF45EF38D
26 #define INCLUDED_ExternalQuaternion_h_GUID_3235DD66_A6E6_47BD_7CC0_51BBF45EF38D
35 #include <type_traits>
40 namespace external_quat {
45 inline Eigen::Quaterniond vecToQuat(types::Vector<3>
const &incRotVec) {
46 return util::quat_exp(incRotVec / 2.);
51 inline types::Matrix<4, 3> jacobian(Eigen::Vector3d
const &incRotVec) {
52 assert(vecToQuatScalarPartSquared(incRotVec) >= 0 &&
53 "Incremental rotation vector's squared norm was greater "
54 "than 1! Precondition fail!");
56 types::Matrix<4, 3> ret;
58 ret.topLeftCorner<3, 3>() =
59 types::SquareMatrix<3>::Identity() * 0.5;
61 incRotVec.transpose() /
62 (-4. * std::sqrt(vecToQuatScalarPartSquared(incRotVec)));
67 inline types::Matrix<4, 3> jacobian(Eigen::Vector3d
const &w) {
68 double a = w.squaredNorm() / 48 + 0.5;
70 Eigen::Matrix3d topBlock =
71 (w * w.transpose()) / 24. + Eigen::Matrix3d::Identity() * a;
73 Eigen::RowVector3d bottomRow =
74 (Eigen::Vector3d(2 * a, 0, 0) + (w[0] * w) / 12 - w / 4)
76 types::Matrix<4, 3> ret;
77 ret << topBlock, bottomRow;
85 #endif // INCLUDED_ExternalQuaternion_h_GUID_3235DD66_A6E6_47BD_7CC0_51BBF45EF38D
The main namespace for all C++ elements of the framework, internal and external.