本文整理汇总了C++中eigen::Quaterniond::vec方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaterniond::vec方法的具体用法?C++ Quaterniond::vec怎么用?C++ Quaterniond::vec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Quaterniond
的用法示例。
在下文中一共展示了Quaterniond::vec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleIMUVelocity
void VideoIMUFusionDevice::handleIMUVelocity(
const OSVR_TimeValue ×tamp, const OSVR_AngularVelocityReport &report) {
using namespace osvr::util::eigen_interop;
Eigen::Quaterniond q = map(report.state.incrementalRotation);
Eigen::Vector3d rot;
if (q.w() >= 1. || q.vec().isZero(1e-10)) {
rot = Eigen::Vector3d::Zero();
} else {
#if 0
auto magnitude = q.vec().blueNorm();
rot = (q.vec() / magnitude * (2. * std::atan2(magnitude, q.w()))) /
report.state.dt;
#else
auto angle = std::acos(q.w());
rot = q.vec().normalized() * angle * 2 / report.state.dt;
#endif
}
m_fusion.handleIMUVelocity(timestamp, rot);
if (m_fusion.running()) {
sendMainPoseReport();
}
sendVelocityReport();
}
示例2: ExponentialMapToQuaternion
Eigen::Quaterniond ExponentialMapToQuaternion(const Eigen::Vector3d& exponential_rotation)
{
double angle = 0.5 * exponential_rotation.norm();
Eigen::Quaterniond quaternion;
quaternion.w() = std::cos(angle);
quaternion.vec() = 0.5 * boost::math::sinc_pi(angle) * exponential_rotation;
return quaternion;
}
示例3: QuaternionToExponentialMap
Eigen::Vector3d QuaternionToExponentialMap(const Eigen::Quaterniond& quaternion)
{
Eigen::Vector3d vec = quaternion.vec();
if (vec.norm() < ITOMP_EPS)
return Eigen::Vector3d::Zero();
double theta = 2.0 * std::acos(quaternion.w());
vec.normalize();
return theta * vec;
}
示例4: handleIMUVelocity
void VideoIMUFusionDevice::handleIMUVelocity(
const OSVR_TimeValue ×tamp, const OSVR_AngularVelocityReport &report) {
using namespace osvr::util::eigen_interop;
Eigen::Quaterniond q = map(report.state.incrementalRotation);
Eigen::Vector3d rot;
if (q.w() >= 1.) {
rot = Eigen::Vector3d::Zero();
} else {
auto magnitude = q.vec().blueNorm();
rot = (q.vec() / magnitude * (2. * std::atan2(magnitude, q.w()))) /
report.state.dt;
/// @todo without transformations being applied to vel quats, this
/// is needed.
// std::swap(rot[0], rot[1]);
rot[1] *= -1.;
rot[2] *= -1.;
}
m_fusion.handleIMUVelocity(timestamp, rot);
if (m_fusion.running()) {
sendMainPoseReport();
}
}