QQuaternion: Deprecate conjugate() and introduce conjugated()

Change-Id: I9aa835138e1e33448fea920f7a5ba99b26a95ebf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Sérgio Martins 2015-05-03 20:03:00 +01:00 committed by Konstantin Ritt
parent 237e73df94
commit 2a2e7ec20a
2 changed files with 23 additions and 5 deletions

View File

@ -301,12 +301,20 @@ void QQuaternion::normalize()
*/
/*!
\fn QQuaternion QQuaternion::conjugate() const
\fn QQuaternion QQuaternion::conjugated() const
\since 5.5
Returns the conjugate of this quaternion, which is
(-x, -y, -z, scalar).
*/
/*!
\fn QQuaternion QQuaternion::conjugate() const
\obsolete
Use conjugated() instead.
*/
/*!
Rotates \a vector with this quaternion to produce a new vector
in 3D space. The following code:
@ -318,12 +326,12 @@ void QQuaternion::normalize()
is equivalent to the following:
\code
QVector3D result = (q * QQuaternion(0, vector) * q.conjugate()).vector();
QVector3D result = (q * QQuaternion(0, vector) * q.conjugated()).vector();
\endcode
*/
QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
{
return (*this * QQuaternion(0, vector) * conjugate()).vector();
return (*this * QQuaternion(0, vector) * conjugated()).vector();
}
/*!

View File

@ -88,7 +88,10 @@ public:
inline QQuaternion inverted() const;
QQuaternion conjugate() const Q_REQUIRED_RESULT;
QQuaternion conjugated() const Q_REQUIRED_RESULT;
#if QT_DEPRECATED_SINCE(5, 5)
QT_DEPRECATED QQuaternion conjugate() const Q_REQUIRED_RESULT;
#endif
QVector3D rotatedVector(const QVector3D& vector) const;
@ -196,11 +199,18 @@ inline QQuaternion QQuaternion::inverted() const
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
}
inline QQuaternion QQuaternion::conjugate() const
inline QQuaternion QQuaternion::conjugated() const
{
return QQuaternion(wp, -xp, -yp, -zp);
}
#if QT_DEPRECATED_SINCE(5, 5)
inline QQuaternion QQuaternion::conjugate() const
{
return conjugated();
}
#endif
inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion)
{
xp += quaternion.xp;