配置环境
Ubuntu 18.04
Eigen3安装
sudo apt-get install libeigen3-dev
g++安装
sudo apt install g++
code
#include<cmath>
#include<eigen3/Eigen/Core>
#include<eigen3/Eigen/Dense>
#include<iostream>
using namespace std;
int main(){
Eigen::Vector3f p(2.0f,1.0f,1.0f);
Eigen::Matrix3f rotation;
float angle = 45*M_PI/180;
rotation << cos(angle), -sin(angle), 0 , sin(angle) , cos(angle) , 0 , 0 , 0 , 1;
Eigen::Matrix3f translation;
translation << 1,0,1,0,1,2,0,0,1;
cout << translation*rotation*p;
return 0;
}