Skip to content

Instantly share code, notes, and snippets.

@SIRHAMY
Created March 18, 2016 01:39
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 SIRHAMY/6d7a14a4dbeb3126ff89 to your computer and use it in GitHub Desktop.
Save SIRHAMY/6d7a14a4dbeb3126ff89 to your computer and use it in GitHub Desktop.
Example showing how to add two Eigen::Quaterniond values
Eigen::Quaterniond myQuaternion; //This is the quaternion we want to store the result in
//These are the two quaternions we'll be adding together
Eigen::Quaterniond q1 = initializeMyQuaternion(exampleParam); //We'll say it initializes to some random, valid vals
Eigen::Quaterniond q2 = initializeMyQuaternion(exampleParam2);
//Perform the addition
myQuaternion.w() = q1.w() + q2.w(); //Add the scalar portion
myQuaternion.vec() = q1.vec() + q2.vec(); //Add the vector portion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment