diff --git a/gtsam/geometry/tests/testRot3.cpp b/gtsam/geometry/tests/testRot3.cpp index 1df342d574..8184059d75 100644 --- a/gtsam/geometry/tests/testRot3.cpp +++ b/gtsam/geometry/tests/testRot3.cpp @@ -589,6 +589,16 @@ TEST(Rot3, quaternion) { EXPECT(assert_equal(Vector(R1.toQuaternion().coeffs()), Vector(q1.coeffs()))); EXPECT(assert_equal(Vector(R2.toQuaternion().coeffs()), Vector(q2.coeffs()))); + // Check accessing the quaternion components via Rot3::quaternion + EXPECT(assert_equal(q1.w(), R1.quaternion().w())); + EXPECT(assert_equal(q1.x(), R1.quaternion().x())); + EXPECT(assert_equal(q1.y(), R1.quaternion().y())); + EXPECT(assert_equal(q1.z(), R1.quaternion().z())); + EXPECT(assert_equal(q2.w(), R2.quaternion().w())); + EXPECT(assert_equal(q2.x(), R2.quaternion().x())); + EXPECT(assert_equal(q2.y(), R2.quaternion().y())); + EXPECT(assert_equal(q2.z(), R2.quaternion().z())); + // Check that quaternion and Rot3 represent the same rotation Point3 p1(1.0, 2.0, 3.0); Point3 p2(8.0, 7.0, 9.0);