Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] Qt Mathematical equivalent of glm::inverse...

    General and Desktop
    2
    5
    1659
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tmason101 last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Isn't "QMatrix4x4::inteverted":http://doc.qt.io/qt-5/qmatrix4x4.html#inverted what you are looking for ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • T
          tmason101 last edited by

          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]

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • T
              tmason101 last edited by

              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]

              1 Reply Last reply Reply Quote 0
              • First post
                Last post