QMatrix4x4: deprecate operator*(QMatrix4x4, QVector3D/QPoint(F))
The operation does not make sense at the "fundamental" level for these classes (algebraic, in this case), so it shouldn't exist. It's also a semantic trap: * it interprets a _vector_ as a _point_ instead (the vector gets 1-extended in 4D) * after the multiplication, it gets perspective divided. These semantics do not belong to operator*. operator*(QVector3D/QPoint(F), QMatrix) will be tackled in a next commit; we don't have a straightforward replacement for it. Drive-by, document that map() interprets vectors as points. [ChangeLog][QtGui][QMatrix4x4] operator* between a QMatrix4x4 and a QVector3D, QPoint, or QPointF has been deprecated in favor of map() and mapVector(). Task-number: QTBUG-89708 Change-Id: Iad78d6eb68cc8cdc3ac16b1635c4d3b522c95213 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 6862ce3d7763d8163cc1350c45bc6adae8b4fc7f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0c413c379a
commit
f576e22f6e
@ -635,16 +635,23 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
|
|||||||
with the matrix applied post-vector.
|
with the matrix applied post-vector.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
|
\fn QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
|
||||||
\relates QMatrix4x4
|
\relates QMatrix4x4
|
||||||
|
|
||||||
|
\obsolete Use QMatrix4x4::map() or QMatrix4x4::mapVector() instead.
|
||||||
|
|
||||||
Returns the result of transforming \a vector according to \a matrix,
|
Returns the result of transforming \a vector according to \a matrix,
|
||||||
with the matrix applied pre-vector.
|
with the matrix applied pre-vector. The vector is transformed as a
|
||||||
|
projective point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_VECTOR4D
|
#ifndef QT_NO_VECTOR4D
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -681,10 +688,14 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
|
|||||||
with the matrix applied post-point.
|
with the matrix applied post-point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
|
\fn QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
|
||||||
\relates QMatrix4x4
|
\relates QMatrix4x4
|
||||||
|
|
||||||
|
\obsolete Use QMatrix4x4::map() instead.
|
||||||
|
|
||||||
Returns the result of transforming \a point according to \a matrix,
|
Returns the result of transforming \a point according to \a matrix,
|
||||||
with the matrix applied pre-point.
|
with the matrix applied pre-point.
|
||||||
*/
|
*/
|
||||||
@ -693,10 +704,14 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
|
|||||||
\fn QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
|
\fn QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
|
||||||
\relates QMatrix4x4
|
\relates QMatrix4x4
|
||||||
|
|
||||||
|
\obsolete Use QMatrix4x4::map() instead.
|
||||||
|
|
||||||
Returns the result of transforming \a point according to \a matrix,
|
Returns the result of transforming \a point according to \a matrix,
|
||||||
with the matrix applied pre-point.
|
with the matrix applied pre-point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
\fn QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
||||||
\overload
|
\overload
|
||||||
@ -1701,6 +1716,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
|
|||||||
\fn QPoint QMatrix4x4::map(const QPoint& point) const
|
\fn QPoint QMatrix4x4::map(const QPoint& point) const
|
||||||
|
|
||||||
Maps \a point by multiplying this matrix by \a point.
|
Maps \a point by multiplying this matrix by \a point.
|
||||||
|
The matrix is applied pre-point.
|
||||||
|
|
||||||
\sa mapRect()
|
\sa mapRect()
|
||||||
*/
|
*/
|
||||||
@ -1708,7 +1724,8 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
|
|||||||
/*!
|
/*!
|
||||||
\fn QPointF QMatrix4x4::map(const QPointF& point) const
|
\fn QPointF QMatrix4x4::map(const QPointF& point) const
|
||||||
|
|
||||||
Maps \a point by multiplying this matrix by \a point.
|
Maps \a point by post-multiplying this matrix by \a point.
|
||||||
|
The matrix is applied pre-point.
|
||||||
|
|
||||||
\sa mapRect()
|
\sa mapRect()
|
||||||
*/
|
*/
|
||||||
@ -1719,6 +1736,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
|
|||||||
\fn QVector3D QMatrix4x4::map(const QVector3D& point) const
|
\fn QVector3D QMatrix4x4::map(const QVector3D& point) const
|
||||||
|
|
||||||
Maps \a point by multiplying this matrix by \a point.
|
Maps \a point by multiplying this matrix by \a point.
|
||||||
|
The matrix is applied pre-point.
|
||||||
|
|
||||||
\sa mapRect(), mapVector()
|
\sa mapRect(), mapVector()
|
||||||
*/
|
*/
|
||||||
@ -1728,7 +1746,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
|
|||||||
|
|
||||||
Maps \a vector by multiplying the top 3x3 portion of this matrix
|
Maps \a vector by multiplying the top 3x3 portion of this matrix
|
||||||
by \a vector. The translation and projection components of
|
by \a vector. The translation and projection components of
|
||||||
this matrix are ignored.
|
this matrix are ignored. The matrix is applied pre-vector.
|
||||||
|
|
||||||
\sa map()
|
\sa map()
|
||||||
*/
|
*/
|
||||||
@ -1741,6 +1759,7 @@ QTransform QMatrix4x4::toTransform(float distanceToPlane) const
|
|||||||
\fn QVector4D QMatrix4x4::map(const QVector4D& point) const;
|
\fn QVector4D QMatrix4x4::map(const QVector4D& point) const;
|
||||||
|
|
||||||
Maps \a point by multiplying this matrix by \a point.
|
Maps \a point by multiplying this matrix by \a point.
|
||||||
|
The matrix is applied pre-point.
|
||||||
|
|
||||||
\sa mapRect()
|
\sa mapRect()
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +107,9 @@ public:
|
|||||||
friend QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
friend QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
||||||
friend QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
friend QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
||||||
#ifndef QT_NO_VECTOR3D
|
#ifndef QT_NO_VECTOR3D
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector);
|
friend QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector);
|
||||||
|
#endif
|
||||||
friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix);
|
friend QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix);
|
||||||
#endif
|
#endif
|
||||||
#ifndef QT_NO_VECTOR4D
|
#ifndef QT_NO_VECTOR4D
|
||||||
@ -117,8 +119,10 @@ public:
|
|||||||
friend QPoint operator*(const QPoint& point, const QMatrix4x4& matrix);
|
friend QPoint operator*(const QPoint& point, const QMatrix4x4& matrix);
|
||||||
friend QPointF operator*(const QPointF& point, const QMatrix4x4& matrix);
|
friend QPointF operator*(const QPointF& point, const QMatrix4x4& matrix);
|
||||||
friend QMatrix4x4 operator-(const QMatrix4x4& matrix);
|
friend QMatrix4x4 operator-(const QMatrix4x4& matrix);
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
friend QPoint operator*(const QMatrix4x4& matrix, const QPoint& point);
|
friend QPoint operator*(const QMatrix4x4& matrix, const QPoint& point);
|
||||||
friend QPointF operator*(const QMatrix4x4& matrix, const QPointF& point);
|
friend QPointF operator*(const QMatrix4x4& matrix, const QPointF& point);
|
||||||
|
#endif
|
||||||
friend QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix);
|
friend QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix);
|
||||||
friend QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor);
|
friend QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor);
|
||||||
friend Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor);
|
friend Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor);
|
||||||
@ -741,6 +745,9 @@ inline QVector3D operator*(const QVector3D& vector, const QMatrix4x4& matrix)
|
|||||||
return QVector3D(x / w, y / w, z / w);
|
return QVector3D(x / w, y / w, z / w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
|
|
||||||
|
QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(vector) or matrix.mapVector(vector) instead")
|
||||||
inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
|
inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
|
||||||
{
|
{
|
||||||
return matrix.map(vector);
|
return matrix.map(vector);
|
||||||
@ -748,6 +755,8 @@ inline QVector3D operator*(const QMatrix4x4& matrix, const QVector3D& vector)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_VECTOR4D
|
#ifndef QT_NO_VECTOR4D
|
||||||
|
|
||||||
inline QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix)
|
inline QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix)
|
||||||
@ -839,16 +848,22 @@ inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(6, 1)
|
||||||
|
|
||||||
|
QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(point) instead")
|
||||||
inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
|
inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
|
||||||
{
|
{
|
||||||
return matrix.map(point);
|
return matrix.map(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_DEPRECATED_VERSION_X_6_1("Use matrix.map(point) instead")
|
||||||
inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
|
inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
|
||||||
{
|
{
|
||||||
return matrix.map(point);
|
return matrix.map(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(Qt::Uninitialized);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user