testBearingS2.cpp
Go to the documentation of this file.
1 
11 
13 
15 
16 using namespace gtsam;
17 
18 static const double tol=1e-5;
19 
20 /* ************************************************************************* */
21 TEST( testBearingS2, basics ) {
23  EXPECT(assert_equal(Rot2(), origin.elevation(), tol));
24  EXPECT(assert_equal(Rot2(), origin.azimuth(), tol));
25 
26  double expAzi = 0.2, expEle = 0.3;
27  BearingS2 actual1(expAzi, expEle);
28  EXPECT(assert_equal(Rot2::fromAngle(expEle), actual1.elevation(), tol));
29  EXPECT(assert_equal(Rot2::fromAngle(expAzi), actual1.azimuth(), tol));
30 }
31 
32 /* ************************************************************************* */
33 TEST( testBearingS2, equals ) {
34  BearingS2 origin, b1(0.2, 0.3), b2(b1), b3(0.1, 0.3), b4(0.2, 0.5);
35  EXPECT(assert_equal(origin, origin, tol));
39 
42  EXPECT(assert_inequal(b1, b4, tol));
43  EXPECT(assert_inequal(b4, b1, tol));
44 }
45 
46 /* ************************************************************************* */
47 TEST( testBearingS2, manifold ) {
48  BearingS2 origin, b1(0.2, 0.3);
49  EXPECT_LONGS_EQUAL(2, origin.dim());
50 
51  EXPECT(assert_equal(Z_2x1, origin.localCoordinates(origin), tol));
52  EXPECT(assert_equal(origin, origin.retract(Z_2x1), tol));
53 
55  EXPECT(assert_equal(b1, b1.retract(Z_2x1), tol));
56 }
57 
58 /* ************************************************************************* */
59 int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
60 /* ************************************************************************* */
Provides additional testing facilities for common data structures.
static int runAllTests(TestResult &result)
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
Vector2 b2(4, -5)
bool assert_inequal(const Matrix &A, const Matrix &B, double tol)
Definition: Matrix.cpp:60
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: BearingS2.h:78
const Rot2 & elevation() const
Definition: BearingS2.h:40
const Rot2 & azimuth() const
Definition: BearingS2.h:39
BearingS2 retract(const Vector &v) const
Definition: BearingS2.cpp:65
Vector localCoordinates(const BearingS2 &p2) const
Local coordinates of BearingS2 manifold neighborhood around current pose.
Definition: BearingS2.cpp:71
#define EXPECT(condition)
Definition: Test.h:150
Array< double, 1, 3 > e(1./3., 0.5, 2.)
traits
Definition: chartTesting.h:28
Vector2 b3(3, -6)
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:154
static Rot2 fromAngle(double theta)
Named constructor from angle in radians.
Definition: Rot2.h:61
int main()
const G double tol
Definition: Group.h:86
TEST(SmartFactorBase, Pinhole)
Manifold measurement between two points on a unit sphere.
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
Definition: Vector.h:45
Vector2 b1(2, -1)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:54