testStereoPoint2.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 
21 #include <gtsam/base/Testable.h>
22 #include <gtsam/base/lieProxies.h>
24 
25 using namespace std;
26 using namespace gtsam;
27 
29 //GTSAM_CONCEPT_LIE_INST(StereoPoint2)
30 
31 
32 //******************************************************************************
33 TEST(StereoPoint2 , Concept) {
35  GTSAM_CONCEPT_ASSERT(IsManifold<StereoPoint2 >);
37 }
38 
39 /* ************************************************************************* */
41  StereoPoint2 p1(1, 2, 3), p2 = p1;
43 }
44 
45 /* ************************************************************************* */
47  StereoPoint2 p1(1, 2, 3), p2(4, 5, 6);
48  Matrix H1, H2;
49 
50  EXPECT(assert_equal(StereoPoint2(5,7,9), p1.compose(p2)));
51 
52  EXPECT(assert_equal(StereoPoint2(3,3,3), p1.between(p2)));
53 
54  EXPECT(assert_equal(StereoPoint2(5,7,9), p1.retract(Vector3(4., 5., 6.))));
55  EXPECT(assert_equal(Vector3(3., 3., 3.), p1.localCoordinates(p2)));
56 }
57 
58 /* ************************************************************************* */
60  Vector d(3);
61  d(0) = 1;
62  d(1) = -1;
63  d(2) = -3;
64  StereoPoint2 a(4, 5, 6), b = a.retract(d), c(5, 4, 3);
66 }
67 
68 /* ************************************************************************* */
70  EXPECT(assert_equal( StereoPoint2(5,6,7), StereoPoint2(4,5,6)+StereoPoint2(1,1,1)));
71  EXPECT(assert_equal( StereoPoint2(3,4,5), StereoPoint2(4,5,6)-StereoPoint2(1,1,1)));
72 }
73 
74 /* ************************************************************************* */
75 TEST(testStereoPoint2, left_right) {
76  StereoPoint2 p1(1,2,3);
77 
78  EXPECT(assert_equal( Point2(1,3), p1.point2()));
79  EXPECT(assert_equal( Point2(2,3), p1.right()));
80 }
81 
82 /* ************************************************************************* */
83 int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
84 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
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.
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
b
Scalar * b
Definition: benchVecAdd.cpp:17
gtsam::utils.numerical_derivative.retract
def retract(a, np.ndarray xi)
Definition: numerical_derivative.py:44
gtsam::Matrix
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
gtsam::IsGroup
Definition: Group.h:42
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
arithmetic
Annotation to mark enums as an arithmetic type.
Definition: attr.h:119
gtsam::IsVectorSpace
Vector Space concept.
Definition: VectorSpace.h:470
simple::p2
static Point3 p2
Definition: testInitializePose3.cpp:51
gtsam::Point2
Vector2 Point2
Definition: Point2.h:32
StereoPoint2.h
A 2D stereo point (uL,uR,v)
p1
Vector3f p1
Definition: MatrixBase_all.cpp:2
TestResult
Definition: TestResult.h:26
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
gtsam
traits
Definition: SFMdata.h:40
main
int main()
Definition: testStereoPoint2.cpp:83
constructor
Definition: init.h:200
gtsam::StereoPoint2
Definition: StereoPoint2.h:34
std
Definition: BFloat16.h:88
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
lieProxies.h
Provides convenient mappings of common member functions for testing.
GTSAM_CONCEPT_ASSERT
#define GTSAM_CONCEPT_ASSERT(concept)
Definition: base/concepts.h:22
TEST
TEST(StereoPoint2, Concept)
Definition: testStereoPoint2.cpp:33


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:08:45