首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有特征的C++中不同参考文献中的表达载体和方向

具有特征的C++中不同参考文献中的表达载体和方向
EN

Stack Overflow用户
提问于 2020-11-22 09:59:22
回答 1查看 181关注 0票数 0

假设我有三次转诊(A,B和C)

我知道以下价值:

  • B在A中的位置(作为特征::Vector3d)
  • B在A中的取向(作为特征::四元数)
  • C在B中的位置(作为特征::Vector3d)
  • C在B中的取向(作为特征::四元数)

如何用C++和特征找到A在C中的位置和方向?

代码语言:javascript
复制
Eigen::Vector3d p_B_in_A = Eigen::Vector3d(...);
Eigen::Quaterniond q_B_in_A = Eigen::Quaterniond(...);
Eigen::Vector3d p_C_in_B = Eigen::Vector3d(...);
Eigen::Quaterniond q_C_in_B = Eigen::Quaterniond(...);

Eigen::Vector3d p_A_in_C = ???
Eigen::Quaterniond q_A_in_C = ???
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-24 19:04:57

我以以下代码为例回答我自己的问题:

代码语言:javascript
复制
Eigen::Affine3d B2A = Eigen::Affine3d::Identity();
B2A.translation() << 2 , -1 , 1;
B2A.linear() << std::sqrt(2)/2,  0, std::sqrt(2)/2,
               -std::sqrt(2)/2,  0, std::sqrt(2)/2,
                        0        , -1,         0;

Eigen::Affine3d C2B = Eigen::Affine3d::Identity();
C2B.translation() << 0, 1, 3*sqrt(2);
C2B.linear() <<  1, 0, 0,
                 0,-1, 0,
                 0, 0,-1;

Eigen::Affine3d A2C = C2B.inverse() * B2A.inverse();
// At this point, the orientation of A in C can be found in
// A2C.linear() as a 3x3 rotation matrix. the position of A 
// in C can be found in A2C.translation() as a Vector3d.

B2A表示B在A帧中的位置和方向。同样,C2B表示B在C中的位置和方向,通过两个变换的逆变换,可以找到A在C中的位置和方向。使用来自本征的仿射是非常有用的空间转换和组合平移和旋转。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64952813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档