/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------1------------------------------------------- */ /** * @file testLie.cpp * @date May, 2015 * @author Frank Dellaert * @brief unit tests for Lie group type machinery */ #include #include #include #include using namespace std; using namespace gtsam; //****************************************************************************** typedef ProductLieGroup MyPoint2Pair; // Define any direct product group to be a model of the multiplicative Group concept namespace gtsam { template<> struct traits : internal::LieGroupTraits { static void Print(const MyPoint2Pair& m, const string& s = "") { cout << s << "(" << m.first << "," << m.second << ")" << endl; } static bool Equals(const MyPoint2Pair& m1, const MyPoint2Pair& m2, double tol = 1e-8) { return m1 == m2; } }; } TEST(Lie, ProductLieGroup) { BOOST_CONCEPT_ASSERT((IsGroup)); BOOST_CONCEPT_ASSERT((IsManifold)); BOOST_CONCEPT_ASSERT((IsLieGroup)); MyPoint2Pair pair1; Vector4 d; d << 1, 2, 3, 4; MyPoint2Pair expected(Point2(1, 2), Point2(3, 4)); MyPoint2Pair pair2 = pair1.retract(d); EXPECT(assert_equal(expected, pair2, 1e-9)); EXPECT(assert_equal(d, pair1.localCoordinates(pair2), 1e-9)); } //****************************************************************************** int main() { TestResult tr; return TestRegistry::runAllTests(tr); } //******************************************************************************