From a91ea4374ee36ccdf60d2271170b3a59975df75a Mon Sep 17 00:00:00 2001 From: Jesse Mapel Date: Wed, 10 Apr 2019 18:45:16 -0700 Subject: [PATCH] Fixed ordering on framer quaternions (#219) --- src/UsgsAstroFrameSensorModel.cpp | 16 ++++++++-------- tests/FrameCameraTests.cpp | 2 +- tests/data/simpleFramerISD.json | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/UsgsAstroFrameSensorModel.cpp b/src/UsgsAstroFrameSensorModel.cpp index 1a5116e..1f6cdba 100644 --- a/src/UsgsAstroFrameSensorModel.cpp +++ b/src/UsgsAstroFrameSensorModel.cpp @@ -1191,10 +1191,10 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( double m[3][3]) const { MESSAGE_LOG(this->m_logger, "Calculating rotation matrix"); // Trigonometric functions for rotation matrix - double w = m_currentParameterValue[3]; - double x = m_currentParameterValue[4]; - double y = m_currentParameterValue[5]; - double z = m_currentParameterValue[6]; + double x = m_currentParameterValue[3]; + double y = m_currentParameterValue[4]; + double z = m_currentParameterValue[5]; + double w = m_currentParameterValue[6]; m[0][0] = w*w + x*x - y*y - z*z; m[0][1] = 2 * (x*y - w*z); @@ -1212,10 +1212,10 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( double m[3][3], const std::vector &adjustments) const { MESSAGE_LOG(this->m_logger, "Calculating rotation matrix with adjustments"); // Trigonometric functions for rotation matrix - double w = getValue(3, adjustments); - double x = getValue(4, adjustments); - double y = getValue(5, adjustments); - double z = getValue(6, adjustments); + double x = getValue(3, adjustments); + double y = getValue(4, adjustments); + double z = getValue(5, adjustments); + double w = getValue(6, adjustments); m[0][0] = w*w + x*x - y*y - z*z; m[0][1] = 2 * (x*y - w*z); diff --git a/tests/FrameCameraTests.cpp b/tests/FrameCameraTests.cpp index 80bcb8f..20ad76d 100644 --- a/tests/FrameCameraTests.cpp +++ b/tests/FrameCameraTests.cpp @@ -229,7 +229,7 @@ TEST_F(FrameSensorModel, Rotation_NPole_Center) { TEST_F(FrameSensorModel, Rotation_SPole_Center) { - sensorModel->setParameterValue(4, 0.0); // phi + sensorModel->setParameterValue(3, 0.0); // phi sensorModel->setParameterValue(0, 0.0); // X sensorModel->setParameterValue(1, 0.0); // Y sensorModel->setParameterValue(2, -1000.0); // Z diff --git a/tests/data/simpleFramerISD.json b/tests/data/simpleFramerISD.json index b22c3e8..9ce2240 100644 --- a/tests/data/simpleFramerISD.json +++ b/tests/data/simpleFramerISD.json @@ -46,7 +46,7 @@ }, "sensor_orientation": { "quaternions": [ - [0.0, -0.707106781186547, 0.0, 0.707106781186547] + [-0.707106781186547, 0.0, 0.707106781186547, 0.0] ] }, "starting_detector_line": 0, -- GitLab