Results 1 to 8 of 8

Thread: QTransform vs QMatrix

  1. #1
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTransform vs QMatrix

    Hi guys,

    I am currently studing QTransform and QMatrix classes, and see only one difference between those classes: QTransform allows perpective transformations. Could anyone explain this difference? Any example would be appreciated.

    Thank you

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTransform vs QMatrix

    I think you've explained it yourself. QTransform allows 3D transformations and is limited to QMatrix 2D transformations. So for example you can rotate something towards the screen (try it with an image).

  3. #3
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QTransform vs QMatrix

    Strange. Doesn't sound like a good reason to have two classes.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  4. #4
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTransform vs QMatrix

    Strange. Doesn't sound like a good reason to have two classes.
    Class designer should explain it : )

    Thank you for help.
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTransform vs QMatrix

    The reason for having two classes is simple. QMatrix was introduced in Qt 3.0 as QWorldMatrix and is a direct port to Qt4 and QTransform was introduced in Qt 4.3 (I think) and simply extends QMatrix with new possibilities. AFAIK since 4.3 QMatrix is (or at least could be if not for complexity reasons) implemented using QTransform. As you can't remove a class from a newer version because of compatibility reasons, another class had to be added. That's a normal approach in Qt. For instance we have a few classes with "V2" (and even "V3") in their names that inherit their previous versions and extend them with new capabilities.

  6. #6
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QTransform vs QMatrix

    Yes, I thought that would be the reason. I don't like backward compatibility. ;-)
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  7. #7
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTransform vs QMatrix

    Ok,

    SO why not to extend the existing class, or add some other functionality, but to create a new class?

    Ok..Just being curious.

    Thanks
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTransform vs QMatrix

    These are different matrices. For instance the detatchment (det()) returns different values for both matrices, therefore you can't just extend QMatrix to become QTransform. Already written code would stop working.

Similar Threads

  1. QMatrix
    By Gopala Krishna in forum General Discussion
    Replies: 1
    Last Post: 7th May 2007, 16:52
  2. QMatrix vs QWMatrix - porting Qt3 to Qt4
    By bitChanger in forum Qt Programming
    Replies: 13
    Last Post: 24th April 2006, 18:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.