diff --git a/gtsam/geometry/tests/testQuaternion.cpp b/gtsam/geometry/tests/testQuaternion.cpp index 51ea99d14..90aeffe28 100644 --- a/gtsam/geometry/tests/testQuaternion.cpp +++ b/gtsam/geometry/tests/testQuaternion.cpp @@ -19,47 +19,54 @@ namespace gtsam { -/// Typedef to an Eigen Quaternion, we disable alignment because -/// geometry objects are stored in boost pool allocators, in Values -/// containers, and and these pool allocators do not support alignment. -typedef Eigen::Quaternion Quaternion; - namespace traits { -/// Define Quaternion to be a model of the Group concept -template<> -struct structure_category { +/// Define Eigen::Quaternion to be a model of the Group concept +template +struct structure_category > { typedef group_tag type; }; } // \namespace gtsam::traits namespace group { -Quaternion compose(const Quaternion&g, const Quaternion& h) { +template +Eigen::Quaternion<_Scalar, _Options> compose( + const Eigen::Quaternion<_Scalar, _Options> &g, + const Eigen::Quaternion<_Scalar, _Options> & h) { return g * h; } -Quaternion between(const Quaternion&g, const Quaternion& h) { +template +Eigen::Quaternion<_Scalar, _Options> between( + const Eigen::Quaternion<_Scalar, _Options> &g, + const Eigen::Quaternion<_Scalar, _Options> & h) { return g.inverse() * h; } -Quaternion inverse(const Quaternion&g) { +template +Eigen::Quaternion<_Scalar, _Options> inverse( + const Eigen::Quaternion<_Scalar, _Options> &g) { return g.inverse(); } namespace traits { -/// Define the trait that specifies Quaternion's identity element -template<> -struct identity { - static const Quaternion value; - typedef Quaternion value_type; +/// Declare the trait that specifies a quaternion's identity element +template +struct identity > { + static const Eigen::Quaternion<_Scalar, _Options> value; + typedef Eigen::Quaternion<_Scalar, _Options> value_type; }; -const Quaternion identity::value = Quaternion::Identity(); +/// Out of line definition of identity +template +const Eigen::Quaternion<_Scalar, _Options> identity< + Eigen::Quaternion<_Scalar, _Options> >::value = Eigen::Quaternion<_Scalar, + _Options>::Identity(); -/// Define the trait that asserts Quaternion is an additive group -template<> -struct flavor { +/// Define the trait that asserts quaternions are a multiplicative group +template +struct flavor > { typedef multiplicative_tag type; }; @@ -67,6 +74,13 @@ struct flavor { } // \namespace gtsam::group } // \namespace gtsam +/** + * GSAM typedef to an Eigen::Quaternion, we disable alignment because + * geometry objects are stored in boost pool allocators, in Values containers, + * and and these pool allocators do not support alignment. + */ +typedef Eigen::Quaternion Quaternion; + /** * @file testCyclic.cpp * @brief Unit tests for cyclic group @@ -84,25 +98,25 @@ using namespace gtsam; typedef Quaternion Q; // Typedef //****************************************************************************** -TEST(Quaternion, Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); +TEST(Quaternion , Concept) { + BOOST_CONCEPT_ASSERT((IsGroup)); } //****************************************************************************** -TEST(Quaternion, Constructor) { - Q g(Eigen::AngleAxisd(1, Vector3(0,0,1))); +TEST(Quaternion , Constructor) { + Q g(Eigen::AngleAxisd(1, Vector3(0, 0, 1))); } //****************************************************************************** -TEST(Quaternion, Compose) { +TEST(Quaternion , Compose) { } //****************************************************************************** -TEST(Quaternion, Between) { +TEST(Quaternion , Between) { } //****************************************************************************** -TEST(Quaternion, Ivnverse) { +TEST(Quaternion , Ivnverse) { } //******************************************************************************