Skip to content

Instantly share code, notes, and snippets.

Created May 15, 2013 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5583715 to your computer and use it in GitHub Desktop.
Save anonymous/5583715 to your computer and use it in GitHub Desktop.
// The translation vector is the first 3 elements 4-th column of the inverse of K
Vector3d t = K.inverse()*A.col(3).head<3>();
// Affine3d is a 4x4 matrix that allows simple manipulation of affine transformations
Affine3d computeOpenGLModelViewMatrix(const Eigen::Matrix3d &Rot, const Vector3d &trans)
{
Affine3d MV = Affine3d::Identity();
MV.linear().matrix() << Rot; // set the upper-left 3x3 rotation part
MV.translation() << trans; // set the 4-th column with the translation
return MV;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment