diff --git a/gtsam/geometry/Cyclic.h b/gtsam/geometry/Cyclic.h index f97f05dc8..cef085374 100644 --- a/gtsam/geometry/Cyclic.h +++ b/gtsam/geometry/Cyclic.h @@ -62,15 +62,15 @@ public: }; -GTSAM_ADDITIVE_GROUP1(size_t,N,Cyclic) +GTSAM_ADDITIVE_GROUP1(size_t, N, Cyclic) -namespace traits { /// Define cyclic group to be a model of the Group concept +namespace traits { template struct structure_category > { typedef group_tag type; }; -} // \namespace gtsam::traits +} } // \namespace gtsam diff --git a/gtsam/geometry/Quaternion.h b/gtsam/geometry/Quaternion.h index dce47beca..79e71da3b 100644 --- a/gtsam/geometry/Quaternion.h +++ b/gtsam/geometry/Quaternion.h @@ -19,18 +19,6 @@ namespace gtsam { -namespace traits { - -/// Define Eigen::Quaternion to be a model of the Lie Group concept -template -struct structure_category > { - typedef lie_group_tag type; -}; - -} // \namespace gtsam::traits - -namespace manifold { - /// Chart for Eigen Quaternions template struct QuaternionChart { @@ -40,7 +28,7 @@ struct QuaternionChart { // internal typedef ManifoldType Q; - typedef typename traits::TangentVector::type Omega; + typedef typename manifold::traits::TangentVector::type Omega; /// Exponential map, simply be converting omega to AngleAxis static Q Expmap(const Omega& omega) { @@ -88,32 +76,25 @@ struct QuaternionChart { } }; +#define GTSAM_MANIFOLD2(T1,A1,T2,A2,MANIFOLD,DIM,SCALAR,OPTIONS,CHART) \ +namespace manifold { \ +namespace traits { \ +template struct dimension > : public boost::integral_constant {};\ +template struct TangentVector > { typedef Eigen::Matrix type;};\ +template struct DefaultChart > { typedef CHART type;};\ +}} + + +GTSAM_MANIFOLD2(typename, _Scalar, int, _Options, Eigen::Quaternion, 3, _Scalar, _Options, QuaternionChart) +GTSAM_MULTIPLICATIVE_GROUP2(typename, _Scalar, int, _Options, Eigen::Quaternion) + +/// Define Eigen::Quaternion to be a model of the Lie Group concept namespace traits { - -/// Define the trait that asserts Quaternion manifold has dimension 3 template -struct dimension > : public boost::integral_constant< - int, 3> { +struct structure_category > { + typedef lie_group_tag type; }; - -/// Define the trait that asserts Quaternion TangentVector is Vector3 -template -struct TangentVector > { - typedef Eigen::Matrix type; -}; - -/// Define the trait that asserts Quaternion TangentVector is Vector3 -template -struct DefaultChart > { - typedef QuaternionChart type; -}; - -} // \namespace gtsam::manifold::traits -} // \namespace gtsam::manifold - -GTSAM_MULTIPLICATIVE_GROUP2(typename,_Scalar, int,_Options ,Eigen::Quaternion) - -} // \namespace gtsam +} /** * GSAM typedef to an Eigen::Quaternion, we disable alignment because @@ -122,3 +103,5 @@ GTSAM_MULTIPLICATIVE_GROUP2(typename,_Scalar, int,_Options ,Eigen::Quaternion) */ typedef Eigen::Quaternion Quaternion; +} // \namespace gtsam +