本文整理汇总了C++中ogre::Matrix3::EigenSolveSymmetric方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::EigenSolveSymmetric方法的具体用法?C++ Matrix3::EigenSolveSymmetric怎么用?C++ Matrix3::EigenSolveSymmetric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Matrix3
的用法示例。
在下文中一共展示了Matrix3::EigenSolveSymmetric方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMessage
void PoseWithCovarianceVisual::setMessage ( const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg ) {
Ogre::Vector3 position = Ogre::Vector3 ( msg->pose.pose.position.x, msg->pose.pose.position.y, msg->pose.pose.position.z );
Ogre::Quaternion orientation = Ogre::Quaternion ( msg->pose.pose.orientation.x, msg->pose.pose.orientation.y, msg->pose.pose.orientation.z, msg->pose.pose.orientation.w );
// Arrow points in -Z direction, so rotate the orientation before display.
// TODO: is it safe to change Arrow to point in +X direction?
Ogre::Quaternion rotation1 = Ogre::Quaternion ( Ogre::Degree( -90 ), Ogre::Vector3::UNIT_Y );
Ogre::Quaternion rotation2 = Ogre::Quaternion ( Ogre::Degree( -180 ), Ogre::Vector3::UNIT_X );
orientation = rotation2 * rotation1 * orientation;
pose_->setPosition( position );
pose_->setOrientation( orientation );
Ogre::Matrix3 C = Ogre::Matrix3 ( msg->pose.covariance[6*0 + 0], msg->pose.covariance[6*0 + 1], msg->pose.covariance[6*0 + 5],
msg->pose.covariance[6*1 + 0], msg->pose.covariance[6*1 + 1], msg->pose.covariance[6*1 + 5],
msg->pose.covariance[6*5 + 0], msg->pose.covariance[6*5 + 1], msg->pose.covariance[6*5 + 5] );
Ogre::Real eigenvalues[3];
Ogre::Vector3 eigenvectors[3];
C.EigenSolveSymmetric(eigenvalues, eigenvectors);
if ( eigenvalues[0] < 0 ) {
ROS_WARN ( "[PoseWithCovarianceVisual setMessage] eigenvalue[0]: %f < 0 ", eigenvalues[0] );
eigenvalues[0] = 0;
}
if ( eigenvalues[1] < 0 ) {
ROS_WARN ( "[PoseWithCovarianceVisual setMessage] eigenvalue[1]: %f < 0 ", eigenvalues[1] );
eigenvalues[1] = 0;
}
if ( eigenvalues[2] < 0 ) {
ROS_WARN ( "[PoseWithCovarianceVisual setMessage] eigenvalue[2]: %f < 0 ", eigenvalues[2] );
eigenvalues[2] = 0;
}
variance_->setColor ( color_variance_ );
variance_->setPosition ( position );
variance_->setOrientation ( Ogre::Quaternion ( eigenvectors[0], eigenvectors[1], eigenvectors[2] ) );
variance_->setScale ( Ogre::Vector3 ( 2*sqrt(eigenvalues[0]), 2*sqrt(eigenvalues[1]), 2*sqrt(eigenvalues[2]) ) );
}