Skip to content

Instantly share code, notes, and snippets.

@elliotwoods
Created July 21, 2014 17:00
Show Gist options
  • Save elliotwoods/c5986f04c75b4962d73e to your computer and use it in GitHub Desktop.
Save elliotwoods/c5986f04c75b4962d73e to your computer and use it in GitHub Desktop.
results of matrix multiplication in openFrameworks
cout << ((ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f) * ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f)) * ofVec3f(1.0f, 0.0f, 0.0f)) << endl;
//0, 0, 0
cout << ((ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f) * ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f)) * ofVec3f(1.0f, 0.0f, 0.0f)) << endl;
//0, 0, 0
cout << ((ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f) * ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f)) * ofVec4f(1.0f, 0.0f, 0.0f, 1.0f)) << endl;
//0, 0, 0, 1
cout << ((ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f) * ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f)) * ofVec4f(1.0f, 0.0f, 0.0f, 1.0f)) << endl;
//0, 0, 0, 2
cout << (ofVec3f(1.0f, 0.0f, 0.0f) * (ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f) * ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f))) << endl;
//0, 0, 0
cout << (ofVec3f(1.0f, 0.0f, 0.0f) * (ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f) * ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f)) * ofVec3f(1.0f, 0.0f, 0.0f)) << endl;
//1, 0, 0
cout << (ofVec4f(1.0f, 0.0f, 0.0f, 1.0f) * (ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f) * ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f))) << endl;
//0, 0, 0, 1
cout << (ofVec4f(1.0f, 0.0f, 0.0f, 1.0f) * (ofMatrix4x4::newScaleMatrix(0.0f, 0.0f, 0.0f) * ofMatrix4x4::newTranslationMatrix(1.0f, 0.0f, 0.0f))) << endl;
//1, 0, 0, 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment