1.下载地址:
http://eigen.tuxfamily.org/index.php?title=Main_Page
进入上边官方网站进行下载如下所示:
找到自己需要的版本下载即可,我下载的是3.3.8(右边的zip)。
(2)解压配置即可
找到你下载的文件,移动到自己想放置的位置,也可不移动。
打开VS2010,新建一个项目,然后选择”项目”—>”属性” 打开工程的属性页。
选择”C/C++” —>”常规”,在”附加包含目录”里加入eigen3.3.8文件夹的路径。
(对于一些第三方的SDK,一般会包含头文件(*.h),静态库文件(*.lib)和动态库文件(*.dll)。为了提高程序的可移植性,建议将第三方库放在解决方案(*.sln)或者(*.vcproj)文件所在的文件夹下,而不要放在其他位置。)
完成后测试一下:
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
//Vector3d v(1, 0, 0);
//Vector3d w(0, 1, 0);
Eigen::Vector3d v;
v(0) = 0;
v(1) = 3;
v(2) = 1;
cout << "Here is the vector v:\n" << v << endl;
Eigen::Vector3d w;
w(0) = 1;
w(1) = 2;
w(2) = -1;
cout << "Here is the vector w:\n" << w << endl;
cout << "Dot product: " << v.dot(w) << endl;
cout << "Cross product:\n" << v.cross(w) << endl;//向量v叉乘向量W为(-5,1,-3)
cout << "Cross product:\n" << w.cross(v) << endl; //向量w叉乘向量v为(5,-1,3)
}
结果展示: