summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/blackberry/bbrotationsensor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/sensors/blackberry/bbrotationsensor.cpp')
-rw-r--r--src/plugins/sensors/blackberry/bbrotationsensor.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/plugins/sensors/blackberry/bbrotationsensor.cpp b/src/plugins/sensors/blackberry/bbrotationsensor.cpp
index e6d038d2..0ed1495b 100644
--- a/src/plugins/sensors/blackberry/bbrotationsensor.cpp
+++ b/src/plugins/sensors/blackberry/bbrotationsensor.cpp
@@ -46,6 +46,8 @@
#include <QScreen>
#include <qpa/qplatformscreen.h>
+using namespace BbUtil;
+
BbRotationSensor::BbRotationSensor(QSensor *sensor)
: BbSensorBackend<QRotationReading>(devicePath(), SENSOR_TYPE_ROTATION_MATRIX, sensor),
m_orientation(Qt::PrimaryOrientation),
@@ -72,35 +74,6 @@ bool BbRotationSensor::addDefaultRange()
return false;
}
-static float getMatrixElement(const float matrix[3*3], int index0, int index1)
-{
- return matrix[index0 * 3 + index1];
-}
-
-static void matrixToEulerZXY(const float matrix[3*3],
- float &thetaX, float &thetaY, float& thetaZ)
-{
- thetaX = asin( getMatrixElement(matrix, 2, 1));
- if ( thetaX < M_PI_2 ) {
- if ( thetaX > -M_PI_2 ) {
- thetaZ = atan2( -getMatrixElement(matrix, 0, 1),
- getMatrixElement(matrix, 1, 1) );
- thetaY = atan2( -getMatrixElement(matrix, 2, 0),
- getMatrixElement(matrix, 2, 2) );
- } else {
- // Not a unique solution
- thetaZ = -atan2( getMatrixElement(matrix, 0, 2),
- getMatrixElement(matrix, 0, 0) );
- thetaY = 0.0;
- }
- } else {
- // Not a unique solution
- thetaZ = atan2( getMatrixElement(matrix, 0, 2),
- getMatrixElement(matrix, 0, 0) );
- thetaY = 0.0;
- }
-}
-
static void remapMatrix(const float inputMatrix[3*3],
const float mappingMatrix[4],
float outputMatrix[3*3])