Eigen::Map<Eigen::Quaterniond> 와 Eigen::Quaterniond 비교

Gunhee Koo·2021년 6월 24일
0

Eigen::Map<Eigen::Quaterniond> 와 Eigen::Quaterniond 를 단순히 사용할때는 별반 차이가 없다.

Eigen::Map 은 애당초 Sparse Matrix를 다루기 위한 Storage 역할을 해주기에, 거대한 Sparse Matrix를 다룰때, 효과적인 성능을 보여줄 것이다.

별반 차이 없음을 아래의 소스코드로 확인함.

#include <eigen3/Eigen/Dense>
#include <iostream>

using namespace std;

int main()
{
    double parameters[7] = {0,0,0,1,3,6,9};
    double paraQ[4] = {0,0,0,1};
    double paraT[3] = {3,6,9};

    Eigen::Map<Eigen::Quaterniond> q_w_curr(parameters);
    Eigen::Map<Eigen::Vector3d> t_w_curr(parameters + 4);
    
    

    cout << "q_w_curr(w,x,y,z) = (" << q_w_curr.w() << 
    ", " << q_w_curr.x() << ", " << q_w_curr.y() << 
    ", " << q_w_curr.z() << ")" << endl;

    cout << "t_w_curr(x,y,z) = (" << t_w_curr.x() << 
    ", " << t_w_curr.y() << ", " << t_w_curr.z() <<
    ")" << endl; 

    
    Eigen::Quaterniond quat(parameters);
    cout << "quat(w, x, y, z) = (" << quat.w() << 
    ", " << quat.x() << ", " << quat.y() << 
    ", " << quat.z() << ")" << endl;
    
    return 0;
}
  
profile
Research & Study

0개의 댓글