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);
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));
53 
54  EXPECT(assert_equal(Z_2x1, b1.localCoordinates(b1), tol));
55  EXPECT(assert_equal(b1, b1.retract(Z_2x1), tol));
56 }
57 
58 /* ************************************************************************* */
59 int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
60 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
simple_graph::b1
Vector2 b1(2, -1)
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EXPECT_LONGS_EQUAL
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:154
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
simple_graph::b2
Vector2 b2(4, -5)
TestableAssertions.h
Provides additional testing facilities for common data structures.
gtsam::Rot2::fromAngle
static Rot2 fromAngle(double theta)
Named constructor from angle in radians.
Definition: Rot2.h:61
simple_graph::b3
Vector2 b3(3, -6)
gtsam::equals
Definition: Testable.h:112
TestResult
Definition: TestResult.h:26
BearingS2.h
Manifold measurement between two points on a unit sphere.
gtsam::Rot2
Definition: Rot2.h:35
gtsam
traits
Definition: SFMdata.h:40
gtsam::TEST
TEST(SmartFactorBase, Pinhole)
Definition: testSmartFactorBase.cpp:38
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
main
int main()
Definition: testBearingS2.cpp:59
gtsam::Z_2x1
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
Definition: Vector.h:46
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:41
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::assert_inequal
bool assert_inequal(const Matrix &A, const Matrix &B, double tol)
Definition: Matrix.cpp:61
gtsam::BearingS2::elevation
const Rot2 & elevation() const
Definition: BearingS2.h:40
gtsam::BearingS2
Definition: BearingS2.h:18
gtsam::BearingS2::azimuth
const Rot2 & azimuth() const
Definition: BearingS2.h:39


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:16:08