De-inline qFuzzyCompare for QMatrix4x4 and QVector4D
Change-Id: Ic412d5cefcc1c41e90ee5cf98814469aec3a91f6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
5a61c88e1f
commit
bfceaf7eb3
@ -754,6 +754,26 @@ QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor)
|
||||
Returns \c true if \a m1 and \a m2 are equal, allowing for a small
|
||||
fuzziness factor for floating-point comparisons; false otherwise.
|
||||
*/
|
||||
bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
||||
{
|
||||
return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
|
||||
qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
|
||||
qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
|
||||
qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
|
||||
qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
|
||||
qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
|
||||
qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
|
||||
qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
|
||||
qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
|
||||
qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
|
||||
qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
|
||||
qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
|
||||
qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
|
||||
qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
|
||||
qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
|
||||
qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
friend QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor);
|
||||
friend Q_GUI_EXPORT QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor);
|
||||
|
||||
friend inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
||||
friend Q_GUI_EXPORT bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2);
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
void scale(const QVector3D& vector);
|
||||
@ -1014,26 +1014,6 @@ inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
|
||||
return m;
|
||||
}
|
||||
|
||||
inline bool qFuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
||||
{
|
||||
return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
|
||||
qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
|
||||
qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
|
||||
qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
|
||||
qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
|
||||
qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
|
||||
qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
|
||||
qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
|
||||
qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
|
||||
qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
|
||||
qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
|
||||
qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
|
||||
qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
|
||||
qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
|
||||
qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
|
||||
qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
|
||||
}
|
||||
|
||||
inline QPoint QMatrix4x4::map(const QPoint& point) const
|
||||
{
|
||||
return *this * point;
|
||||
|
@ -397,6 +397,10 @@ QT_BEGIN_NAMESPACE
|
||||
Returns \c true if \a v1 and \a v2 are equal, allowing for a small
|
||||
fuzziness factor for floating-point comparisons; false otherwise.
|
||||
*/
|
||||
bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) && qFuzzyCompare(v1.v[1], v2.v[1]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
/*!
|
||||
@ -994,6 +998,12 @@ QVector3D QVector3D::unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &pr
|
||||
Returns \c true if \a v1 and \a v2 are equal, allowing for a small
|
||||
fuzziness factor for floating-point comparisons; false otherwise.
|
||||
*/
|
||||
bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
|
||||
qFuzzyCompare(v1.v[1], v2.v[1]) &&
|
||||
qFuzzyCompare(v1.v[2], v2.v[2]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
|
||||
@ -1502,6 +1512,13 @@ QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
|
||||
Returns \c true if \a v1 and \a v2 are equal, allowing for a small
|
||||
fuzziness factor for floating-point comparisons; false otherwise.
|
||||
*/
|
||||
bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
|
||||
qFuzzyCompare(v1.v[1], v2.v[1]) &&
|
||||
qFuzzyCompare(v1.v[2], v2.v[2]) &&
|
||||
qFuzzyCompare(v1.v[3], v2.v[3]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
|
||||
|
@ -155,7 +155,7 @@ QT_WARNING_POP
|
||||
return QVector2D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1]);
|
||||
}
|
||||
|
||||
constexpr friend inline bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept;
|
||||
friend Q_GUI_EXPORT bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept;
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
constexpr QVector3D toVector3D() const noexcept;
|
||||
@ -296,7 +296,7 @@ QT_WARNING_POP
|
||||
return QVector3D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2]);
|
||||
}
|
||||
|
||||
constexpr friend inline bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept;
|
||||
friend Q_GUI_EXPORT bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept;
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
constexpr QVector2D toVector2D() const noexcept;
|
||||
@ -430,7 +430,7 @@ QT_WARNING_POP
|
||||
return QVector4D(vector.v[0] / divisor.v[0], vector.v[1] / divisor.v[1], vector.v[2] / divisor.v[2], vector.v[3] / divisor.v[3]);
|
||||
}
|
||||
|
||||
constexpr friend inline bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept;
|
||||
friend Q_GUI_EXPORT bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept;
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
constexpr QVector2D toVector2D() const noexcept;
|
||||
@ -451,6 +451,7 @@ private:
|
||||
|
||||
friend class QVector2D;
|
||||
friend class QVector3D;
|
||||
friend class QMatrix4x4;
|
||||
#ifndef QT_NO_MATRIX4X4
|
||||
friend QVector4D operator*(const QVector4D& vector, const QMatrix4x4& matrix);
|
||||
friend QVector4D operator*(const QMatrix4x4& matrix, const QVector4D& vector);
|
||||
@ -607,11 +608,6 @@ constexpr inline float QVector2D::dotProduct(QVector2D v1, QVector2D v2) noexcep
|
||||
return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1];
|
||||
}
|
||||
|
||||
constexpr inline bool qFuzzyCompare(QVector2D v1, QVector2D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) && qFuzzyCompare(v1.v[1], v2.v[1]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
constexpr inline QVector3D QVector2D::toVector3D() const noexcept
|
||||
{
|
||||
@ -835,13 +831,6 @@ inline float QVector3D::distanceToLine(QVector3D point, QVector3D direction) con
|
||||
return (*this - p).length();
|
||||
}
|
||||
|
||||
constexpr inline bool qFuzzyCompare(QVector3D v1, QVector3D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
|
||||
qFuzzyCompare(v1.v[1], v2.v[1]) &&
|
||||
qFuzzyCompare(v1.v[2], v2.v[2]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
constexpr inline QVector2D QVector3D::toVector2D() const noexcept
|
||||
{
|
||||
@ -1038,14 +1027,6 @@ constexpr float QVector4D::dotProduct(QVector4D v1, QVector4D v2) noexcept
|
||||
return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2] + v1.v[3] * v2.v[3];
|
||||
}
|
||||
|
||||
constexpr inline bool qFuzzyCompare(QVector4D v1, QVector4D v2) noexcept
|
||||
{
|
||||
return qFuzzyCompare(v1.v[0], v2.v[0]) &&
|
||||
qFuzzyCompare(v1.v[1], v2.v[1]) &&
|
||||
qFuzzyCompare(v1.v[2], v2.v[2]) &&
|
||||
qFuzzyCompare(v1.v[3], v2.v[3]);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
|
||||
constexpr inline QVector2D QVector4D::toVector2D() const noexcept
|
||||
|
Loading…
x
Reference in New Issue
Block a user