From 6ef40175e50599a9c19d25cd1e2d3a658a61b494 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 26 Jan 2015 11:37:45 +0400 Subject: Introduce QMatrix4x4::isAffine() - a convenience method thats checks if the matrix has no projective coefficients. Change-Id: Ieea8ac2e4237b471a683ad5010672b1e89a0c953 Reviewed-by: Sean Harmer --- src/gui/math3d/qmatrix4x4.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gui/math3d/qmatrix4x4.h') diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index 31a4dbf1ca..74329b7cdd 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -77,6 +77,8 @@ public: inline void setRow(int index, const QVector4D& value); #endif + inline bool isAffine() const; + inline bool isIdentity() const; inline void setToIdentity(); @@ -302,6 +304,11 @@ inline void QMatrix4x4::setRow(int index, const QVector4D& value) Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor); +inline bool QMatrix4x4::isAffine() const +{ + return m[0][3] == 0.0f && m[1][3] == 0.0f && m[2][3] == 0.0f && m[3][3] == 1.0f; +} + inline bool QMatrix4x4::isIdentity() const { if (flagBits == Identity) -- cgit v1.2.1