Eigen

Here is some example code for using the Eigen library from Pushkar Kolhe! Make sure you include all the right stuff and set up the namespace, otherwise it won't work.

#include <iostream>
#include "Eigen/Core"
#include "Eigen/Eigen"

using namespace std;
using namespace Eigen;

int main() {

    // Definitions
    Vector3d U1 = Vector3d::UnitX();
    Vector3d V1, V2;
    Matrix3d R1, R2;
    Transform<double, 3, Affine> T1;

    // Assigning
    V1 << 1, 2, 3;
    R1 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
    R2 = AngleAxisd(M_PI*2/3, V1);
    T1 = AngleAxisd(M_PI, U1);

    Vector3d T1_trans = T1.translation();
    V2 = T1*V1;

    //
    cout << "V1 is " << endl << V1 << endl;
    cout << "V2 = Applying T1 to V1" << endl << V2 << endl;
    cout << "R1 is " << endl << R1 << endl;
    cout << "R2 is " << endl << R2 << endl;
    cout << "T1 is " << endl << T1.matrix() << endl;
    cout << "Translational part of T1 is "<< endl << T1_trans << endl;
    return 0;
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License

Subscription expired — please renew

Pro account upgrade has expired for this site and the site is now locked. If you are the master administrator for this site, please renew your subscription or delete your outstanding sites or stored files, so that your account fits in the free plan.