Last active
July 12, 2017 15:37
-
-
Save stfuchs/3d79bccf979300fa05629c5e89bb7a6a to your computer and use it in GitHub Desktop.
Eigen Geometry Cheat Sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Eigen/Geometry> | |
int main(int argc, char** argv) | |
{ | |
Eigen::Quaterniond q1(0, 0, 0, 1.); | |
Eigen::Vector3d t1(1., 0, 1.); | |
Eigen::Vector3d p1 = q1*Eigen::Vector3d(0,0,0) + t1; | |
//Isometry if only rotation and translation components | |
Eigen::Isometry3d tf = Eigen::Translation3d(t1) * q1; | |
Eigen::Affine3d tf_affine = tf; | |
Eigen::Matrix4d tf_mat = tf_affine.matrix(); | |
Eigen::Vector3d p2 = tf_mat.inverse() * p1; | |
Eigen::Quaterniond q2(tf_mat.rotation()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment