25 #ifndef INCLUDED_ExponentialMap_h_GUID_FB61635E_CF8A_4FAE_5343_2258F4BC1E60
26 #define INCLUDED_ExponentialMap_h_GUID_FB61635E_CF8A_4FAE_5343_2258F4BC1E60
46 template <
typename Derived>
47 inline Eigen::Matrix3d
51 ret << 0, -v.z(), v.y(),
75 namespace matrix_exponential_map {
82 if (omega.squaredNorm() > M_PI * M_PI) {
84 omega = ((1 - (2 * M_PI) / omega.norm()) * omega).eval();
90 template <
typename Derived>
91 inline double getAngle(Eigen::MatrixBase<Derived>
const &omega) {
98 template <
typename Derived>
99 inline Eigen::Quaterniond
100 getQuat(Eigen::MatrixBase<Derived>
const &omega) {
102 auto xyz = omega * std::sin(theta / 2.);
103 return Eigen::Quaterniond(std::cos(theta / 2.), xyz.x(), xyz.y(),
110 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
113 template <
typename Derived>
121 if (&other !=
this) {
122 m_omega = other.m_omega;
123 m_gotTheta = other.m_gotTheta;
125 m_theta = other.m_theta;
127 m_gotBigOmega = other.m_gotBigOmega;
129 m_bigOmega = other.m_bigOmega;
131 m_gotR = other.m_gotR;
135 m_gotQuat = other.m_gotQuat;
137 m_quat = other.m_quat;
145 if (&other !=
this) {
146 m_omega = std::move(other.m_omega);
147 m_gotTheta = std::move(other.m_gotTheta);
149 m_theta = std::move(other.m_theta);
151 m_gotBigOmega = std::move(other.m_gotBigOmega);
153 m_bigOmega = std::move(other.m_bigOmega);
155 m_gotR = std::move(other.m_gotR);
157 m_R = std::move(other.m_R);
159 m_gotQuat = std::move(other.m_gotQuat);
161 m_quat = std::move(other.m_quat);
167 template <
typename Derived>
168 void reset(Eigen::MatrixBase<Derived>
const &omega) {
177 if (!m_gotBigOmega) {
178 m_gotBigOmega =
true;
207 double k1 = 1. - theta * theta / 6.;
210 double k2 = theta / 2. - theta * theta * theta / 24.;
212 m_R = Eigen::Matrix3d::Identity() + k1 * Omega +
218 Eigen::Quaterniond
const &getQuaternion() {
222 auto xyz = m_omega * std::sin(theta / 2.);
223 m_quat = Eigen::Quaterniond(std::cos(theta / 2.), xyz.x(),
230 Eigen::Vector3d m_omega;
231 bool m_gotTheta =
false;
233 bool m_gotBigOmega =
false;
234 Eigen::Matrix3d m_bigOmega;
237 bool m_gotQuat =
false;
238 Eigen::Quaterniond m_quat;
244 #endif // INCLUDED_ExponentialMap_h_GUID_FB61635E_CF8A_4FAE_5343_2258F4BC1E60
double getAngle(Eigen::MatrixBase< Derived > const &omega)
void avoidSingularities(T &&omega)
The main namespace for all C++ elements of the framework, internal and external.
Eigen::Matrix3d makeSkewSymmetrixCrossProductMatrix(Eigen::MatrixBase< Derived > const &v)
Header wrapping include of and for warning quieting.
Contained cached computed values.
ExponentialMapData & operator=(ExponentialMapData const &other)
assignment operator - its presence is an optimization only.
ExponentialMapData & operator=(ExponentialMapData &&other)
move-assignment operator - its presence is an optimization only.
Eigen::Quaterniond getQuat(Eigen::MatrixBase< Derived > const &omega)
Eigen::Matrix3d const & getRotationMatrix()
void reset(Eigen::MatrixBase< Derived > const &omega)
Eigen::Matrix3d const & getBigOmega()
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ExponentialMapData(Eigen::MatrixBase< Derived > const &omega)