Skip to content

Commit

Permalink
Add unit tests for Rot3::quaternion
Browse files Browse the repository at this point in the history
  • Loading branch information
HViktorTsoi committed Jun 7, 2022
1 parent 605f6f1 commit 5acd6ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gtsam/geometry/tests/testRot3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5acd6ac

Please sign in to comment.