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 
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
inverse
const EIGEN_DEVICE_FUNC InverseReturnType inverse() const
Definition: ArrayCwiseUnaryOps.h:411
P
static Point3 P(0.2, 0.7, -2.0)
d
static const double d[K][N]
Definition: igam.h:11
GTSAM_CONCEPT_TESTABLE_INST
#define GTSAM_CONCEPT_TESTABLE_INST(T)
Definition: Testable.h:176
Testable.h
Concept check for values that can be used in unit tests.
TestHarness.h
simple::R3
static Rot3 R3
Definition: testInitializePose3.cpp:54
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
gtsam::Rot3::retractCayley
Rot3 retractCayley(const Vector &omega) const
Retraction from R^3 to Rot3 manifold using the Cayley transform.
Definition: Rot3.h:355
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
Rot3.h
3D rotation represented as a rotation matrix or quaternion
Expmap
Pose2_ Expmap(const Vector3_ &xi)
Definition: InverseKinematicsExampleExpressions.cpp:47
gtsam::Rot3
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition: Rot3.h:58
GTSAM_CONCEPT_LIE_INST
#define GTSAM_CONCEPT_LIE_INST(T)
Definition: Lie.h:372
TestResult
Definition: TestResult.h:26
gtsam::Rot3::localCayley
Vector3 localCayley(const Rot3 &other) const
Inverse of retractCayley.
Definition: Rot3.h:360
R
static Rot3 R
Definition: testRot3M.cpp:31
so3::R2
SO3 R2
Definition: testShonanFactor.cpp:43
gtsam
traits
Definition: chartTesting.h:28
CHECK
#define CHECK(condition)
Definition: Test.h:108
std
Definition: BFloat16.h:88
origin
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
Definition: gnuplot_common_settings.hh:45
TEST
TEST(Rot3, manifold_cayley)
Definition: testRot3M.cpp:35
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
main
int main()
Definition: testRot3M.cpp:65


gtsam
Author(s):
autogenerated on Tue Jun 25 2024 03:06:41