Skip to content
  • Giuseppe D'Angelo's avatar
    QMatrix4x4: deprecate operator*(QVector3D, QMatrix4x4) · 2c55e121
    Giuseppe D'Angelo authored
    
    
    The operation is sketchy for a number of reasons:
    
    1) Mathematically, it doesn't make sense. The code interprets the
    QVector3D as a point, extending it with w=1, and uses it as a
    row vector. But similarly, the vector could be intepreted as a
    directional vector, with w=0. No semantic is "better" than the
    other.
    
    2) QMatrix4x4 is not meant to be post-multiplied. Granted,
    one could use a QMatrix4x4 as arbitrary storage for 16 floats,
    but QMatrix4x4 builds itself to be always *pre* multiplied
    (e.g. translate changes the 4th column, not the 4th row). We
    can keep post multiplication for the general case if we do it
    against a QVector4D, but I don't feel that we should support it
    also for QVector3D.
    
    [ChangeLog][QtGui][QMatrix4x4] The multiplication operator
    (operator*) between a QVector3D and a QMatrix4x4 has been deprecated.
    User code needs to extend the QVector3D to a QVector4D first
    (by specifying the intended w coordinate), and then multiply
    the QVector4D by the matrix.
    
    Change-Id: I41b64d8ab7eb6126dc4c49fe29cf3f1b7afc7987
    Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
    (cherry picked from commit 654a2164
    
    )
    Reviewed-by: default avatarQt Cherry-pick Bot <cherrypick_bot@qt-project.org>
    2c55e121