From 20ac6b85c8a1cf3ffba0606b741504bd9b6757f2 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Mon, 1 Mar 2010 21:56:13 +0000 Subject: [PATCH] Added static dim() functions to remaining geometry types so that dimensions can be calculated on size alone. --- cpp/Pose3.h | 3 +++ cpp/Rot2.h | 3 +++ cpp/Rot3.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/cpp/Pose3.h b/cpp/Pose3.h index 106e882c5..4db5ff3ee 100644 --- a/cpp/Pose3.h +++ b/cpp/Pose3.h @@ -61,6 +61,9 @@ namespace gtsam { Pose3 transform_to(const Pose3& pose) const; + /** get the dimension by the type */ + static inline size_t dim() { return 6; }; + private: /** Serialization function */ friend class boost::serialization::access; diff --git a/cpp/Rot2.h b/cpp/Rot2.h index 40e3858a3..12de03caa 100644 --- a/cpp/Rot2.h +++ b/cpp/Rot2.h @@ -75,6 +75,9 @@ namespace gtsam { /** rotate from world to rotated = R'*p */ Point2 unrotate(const Point2& p) const; + /** get the dimension by the type */ + static inline size_t dim() { return 1; }; + private: /** Serialization function */ friend class boost::serialization::access; diff --git a/cpp/Rot3.h b/cpp/Rot3.h index f41bc7816..0c42dd09d 100644 --- a/cpp/Rot3.h +++ b/cpp/Rot3.h @@ -106,6 +106,9 @@ namespace gtsam { */ Vector ypr() const; + /** get the dimension by the type */ + static inline size_t dim() { return 3; }; + private: /** Serialization function */ friend class boost::serialization::access;