From 61c84e2d9c46de40d22f6fafbdd23d4015025516 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 7 Feb 2014 15:30:53 +0200 Subject: Mostly revert the rotations refactor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quaternions are actually easier to use in most use cases. Added some convenience functionality for QML to enable using axis/angle combinations, too. Change-Id: I61c76e0967b4808aa9adaf43dfe6f4596c9ce353 Reviewed-by: Tomi Korpipää --- src/datavisualization/data/qscatterdataitem.cpp | 51 +++++++------------------ 1 file changed, 13 insertions(+), 38 deletions(-) (limited to 'src/datavisualization/data/qscatterdataitem.cpp') diff --git a/src/datavisualization/data/qscatterdataitem.cpp b/src/datavisualization/data/qscatterdataitem.cpp index a3e7b12d..9751dfeb 100644 --- a/src/datavisualization/data/qscatterdataitem.cpp +++ b/src/datavisualization/data/qscatterdataitem.cpp @@ -37,9 +37,7 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION * Constructs QScatterDataItem. */ QScatterDataItem::QScatterDataItem() - : d_ptr(0), // private data doesn't exist by default (optimization) - m_rotationAxis(upVector), - m_rotationAngle(0.0f) + : d_ptr(0) // private data doesn't exist by default (optimization) { } @@ -49,21 +47,17 @@ QScatterDataItem::QScatterDataItem() */ QScatterDataItem::QScatterDataItem(const QVector3D &position) : d_ptr(0), - m_position(position), - m_rotationAxis(upVector), - m_rotationAngle(0.0f) + m_position(position) { } /*! - * Constructs QScatterDataItem with \a position, \a rotationAxis and \a rotationAngle. + * Constructs QScatterDataItem with \a position and \a rotation. */ -QScatterDataItem::QScatterDataItem(const QVector3D &position, const QVector3D &rotationAxis, - float rotationAngle) +QScatterDataItem::QScatterDataItem(const QVector3D &position, const QQuaternion &rotation) : d_ptr(0), m_position(position), - m_rotationAxis(rotationAxis), - m_rotationAngle(rotationAngle) + m_rotation(rotation) { } @@ -88,8 +82,7 @@ QScatterDataItem::~QScatterDataItem() QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other) { m_position = other.m_position; - m_rotationAxis = other.m_rotationAxis; - m_rotationAngle = other.m_rotationAngle; + m_rotation = other.m_rotation; if (other.d_ptr) createExtraData(); @@ -110,35 +103,17 @@ QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other) */ /*! - * \fn void QScatterDataItem::setRotationAxis(const QVector3D &axis) - * Sets rotation \a axis of this data item. - * If the series also has rotation, the resulting rotation quaternions - * are multiplied together at render time. - * Defaults to Y-axis. - * - * \sa setRotationAngle() - */ - -/*! - * \fn QVector3D QScatterDataItem::rotationAxis() const - * \return rotation axis of this data item. - * \sa setRotationAxis(), setRotationAngle() - */ - -/*! - * \fn void QScatterDataItem::setRotationAngle(float angle) - * Sets rotation \a angle of this data item. - * If the series also has rotation, the resulting rotation quaternions - * are multiplied together at render time. + * \fn void QScatterDataItem::setRotation(const QQuaternion &rotation) + * Sets \a rotation to this data item. + * The \a rotation should be a normalized QQuaternion. + * If the series also has rotation, item and series rotations are multiplied together. * Defaults to no rotation. - * - * \sa setRotationAxis() */ /*! - * \fn float QScatterDataItem::rotationAngle() const - * \return rotation angle of this data item. - * \sa setRotationAxis(), setRotationAngle() + * \fn QQuaternion QScatterDataItem::rotation() const + * \return rotation of this data item. + * \sa setRotation() */ /*! -- cgit v1.2.3