[SOLVED] Qt Mathematical equivalent of glm::inverse...
-
Hello,
Hopefully this is a simple question. I am trying to rewrite some glm-based mathematical code to the Qt equivalent and I ran into a stumbling block.
What is the Qt equivalent of the following:
@
glm::vec4 forward = glm::inverse(orientation()) * glm::vec4(0,0,-1,1);
return glm::vec3(forward);
@So far, what I have is:
@
QVector4D forward = getOrientation() * QVector4D(0.0f, 0.0f, -1.0f, 1.0f);//getOrientation returns a QMatrix4x4...
@But I am not sure of how to get the inverse to pass to the QVector4D forward variable.
Thank you.
-
Hi,
Isn't "QMatrix4x4::inteverted":http://doc.qt.io/qt-5/qmatrix4x4.html#inverted what you are looking for ?
-
I feel like an idiot; I was reading my own code wrong and thought that the entire line needed to be inverted versus just the orientation matrix.
Thank you!
[quote author="SGaist" date="1424218578"]Hi,
Isn't "QMatrx4x4::inteverted":http://doc.qt.io/qt-5/qmatrix4x4.html#inverted what you are looking for ?[/quote]
-
You're welcome !
Don't feel like that, matrix stuff is easy to get lost in ;)
Please don't forget to update the thread title prepending [solved] so other forum users may know as solution has been found :)
-
Done!
[quote author="SGaist" date="1424301856"]You're welcome !
Don't feel like that, matrix stuff is easy to get lost in ;)
Please don't forget to update the thread title prepending [solved] so other forum users may know as solution has been found :)[/quote]