Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Qt Mathematical equivalent of glm::inverse...
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.1k Views 1 Watching
  • 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 Offline
    T Offline
    tmason101
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • T Offline
        T Offline
        tmason101
        wrote on last edited by
        #3

        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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0
          • T Offline
            T Offline
            tmason101
            wrote on last edited by
            #5

            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
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved