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  BOOST_CONCEPT_ASSERT((IsManifold<StereoPoint2 >));
37 }
38 
39 /* ************************************************************************* */
41  StereoPoint2 p1(1, 2, 3), p2 = p1;
42  EXPECT(assert_equal(p1, p2));
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 /* ************************************************************************* */
59 TEST( StereoPoint2, retract) {
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);
65  EXPECT(assert_equal(b,c));
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 /* ************************************************************************* */
Scalar * b
Definition: benchVecAdd.cpp:17
Concept check for values that can be used in unit tests.
Provides convenient mappings of common member functions for testing.
static int runAllTests(TestResult &result)
Eigen::Vector3d Vector3
Definition: Vector.h:43
Vector3f p1
Vector2 Point2
Definition: Point2.h:27
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept< ListOfOneContainer< int > >))
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Point2 right() const
Definition: StereoPoint2.h:125
Definition: Half.h:150
Vector Space concept.
Definition: VectorSpace.h:470
Array33i a
Point2 point2() const
Definition: StereoPoint2.h:120
Eigen::VectorXd Vector
Definition: Vector.h:38
#define EXPECT(condition)
Definition: Test.h:151
traits
Definition: chartTesting.h:28
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:42
Annotation to mark enums as an arithmetic type.
Definition: attr.h:75
int main()
A 2D stereo point (uL,uR,v)
static Point3 p2
TEST(StereoPoint2, Concept)
#define GTSAM_CONCEPT_TESTABLE_INST(T)
Definition: Testable.h:174


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:49:57