Rotation matrix in Eigen

前端 未结 1 1707
轻奢々
轻奢々 2021-01-05 00:36

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.

1条回答
  •  轮回少年
    2021-01-05 01:07

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

    #include 
    using namespace Eigen;
    
    int main() {
      Vector3f A, B;
      Matrix3f R;
      R = Quaternionf().setFromTwoVectors(A,B);
    }
    

    0 讨论(0)
提交回复
热议问题