Skip to content

Instantly share code, notes, and snippets.

@stfuchs
Last active July 12, 2017 15:37
Show Gist options
  • Save stfuchs/3d79bccf979300fa05629c5e89bb7a6a to your computer and use it in GitHub Desktop.
Save stfuchs/3d79bccf979300fa05629c5e89bb7a6a to your computer and use it in GitHub Desktop.
Eigen Geometry Cheat Sheet
#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