testRot3M.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #include <gtsam/geometry/Rot3.h>
20 #include <gtsam/base/Testable.h>
22 
23 #ifndef GTSAM_USE_QUATERNIONS
24 
25 using namespace std;
26 using namespace gtsam;
27 
30 
31 static Rot3 R = Rot3::Rodrigues(0.1, 0.4, 0.2);
32 static Point3 P(0.2, 0.7, -2.0);
33 
34 /* ************************************************************************* */
35 TEST(Rot3, manifold_cayley)
36 {
37  Rot3 gR1 = Rot3::Rodrigues(0.1, 0.4, 0.2);
38  Rot3 gR2 = Rot3::Rodrigues(0.3, 0.1, 0.7);
39  Rot3 origin;
40 
41  // log behaves correctly
42  Vector d12 = gR1.localCayley(gR2);
43  CHECK(assert_equal(gR2, gR1.retractCayley(d12)));
44  Vector d21 = gR2.localCayley(gR1);
45  CHECK(assert_equal(gR1, gR2.retractCayley(d21)));
46 
47  // Check that log(t1,t2)=-log(t2,t1)
48  CHECK(assert_equal(d12,-d21));
49 
50  // lines in canonical coordinates correspond to Abelian subgroups in SO(3)
51  Vector d = Vector3(0.1, 0.2, 0.3);
52  // exp(-d)=inverse(exp(d))
54  // exp(5d)=exp(2*d+3*d)=exp(2*d)exp(3*d)=exp(3*d)exp(2*d)
55  Rot3 R2 = Rot3::Expmap (2 * d);
56  Rot3 R3 = Rot3::Expmap (3 * d);
57  Rot3 R5 = Rot3::Expmap (5 * d);
58  CHECK(assert_equal(R5,R2*R3));
59  CHECK(assert_equal(R5,R3*R2));
60 }
61 
62 #endif
63 
64 /* ************************************************************************* */
65 int main() {
66  TestResult tr;
67  return TestRegistry::runAllTests(tr);
68 }
69 /* ************************************************************************* */
70 
#define CHECK(condition)
Definition: Test.h:108
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
Eigen::Vector3d Vector3
Definition: Vector.h:43
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set origin
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
Rot3 retractCayley(const Vector &omega) const
Retraction from R^3 to Rot3 manifold using the Cayley transform.
Definition: Rot3.h:355
static Point3 P(0.2, 0.7, -2.0)
Pose2_ Expmap(const Vector3_ &xi)
Definition: BFloat16.h:88
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
#define GTSAM_CONCEPT_LIE_INST(T)
Definition: Lie.h:372
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
Vector3 localCayley(const Rot3 &other) const
Inverse of retractCayley.
Definition: Rot3.h:360
Eigen::VectorXd Vector
Definition: Vector.h:38
static Rot3 R
Definition: testRot3M.cpp:31
traits
Definition: chartTesting.h:28
static Rot3 R3
int main()
Definition: testRot3M.cpp:65
Vector3 Point3
Definition: Point3.h:38
TEST(Rot3, manifold_cayley)
Definition: testRot3M.cpp:35
#define GTSAM_CONCEPT_TESTABLE_INST(T)
Definition: Testable.h:176
3D rotation represented as a rotation matrix or quaternion


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:39:18