本征旋转矩阵 [英] Rotation matrix in Eigen

查看:128
本文介绍了本征旋转矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用特征库获取将向量A旋转为向量B的旋转矩阵吗?
我已经搜索了一段时间,但是找不到相关的api。

Can I use the Eigen library to get the rotation matrix which rotates vector A to vector B? I have been searching for a while, but cannot find related api.

推荐答案

您首先必须构造一个< a href = http://eigen.tuxfamily.org/dox-devel/classEigen_1_1QuaternionBase.html#ac35460294d855096e9b687cadf821452 rel = noreferrer>四元数,然后将其转换为矩阵,例如:

You first have to construct a quaternion and then convert it to a matrix, for instance:

#include <Eigen/Geometry>
using namespace Eigen;

int main() {
  Vector3f A, B;
  Matrix3f R;
  R = Quaternionf().setFromTwoVectors(A,B);
}

这篇关于本征旋转矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆