From de170d5f3a4767fc2673c8439986ce9314c7987f Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 07:53:40 -0400 Subject: [PATCH] use enum dimension for camera DoF --- gtsam/geometry/Cal3DS2.h | 10 +++------- gtsam/geometry/Cal3Unified.h | 7 +++---- gtsam/geometry/Cal3_S2.h | 11 +++-------- gtsam/geometry/Cal3_S2Stereo.h | 11 +++-------- gtsam/geometry/CalibratedCamera.h | 10 +++------- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/gtsam/geometry/Cal3DS2.h b/gtsam/geometry/Cal3DS2.h index d4461f23f..3e62f758d 100644 --- a/gtsam/geometry/Cal3DS2.h +++ b/gtsam/geometry/Cal3DS2.h @@ -33,13 +33,9 @@ class GTSAM_EXPORT Cal3DS2 : public Cal3DS2_Base { typedef Cal3DS2_Base Base; -private: - - static const size_t dimension_ = 9; - public: - enum { dimension = dimension_ }; + enum { dimension = 9 }; /// @name Standard Constructors /// @{ @@ -80,10 +76,10 @@ public: Vector localCoordinates(const Cal3DS2& T2) const ; /// Return dimensions of calibration manifold object - virtual size_t dim() const { return dimension_ ; } + virtual size_t dim() const { return dimension ; } /// Return dimensions of calibration manifold object - static size_t Dim() { return dimension_; } + static size_t Dim() { return dimension; } /// @} /// @name Clone diff --git a/gtsam/geometry/Cal3Unified.h b/gtsam/geometry/Cal3Unified.h index 4feba996a..ae75c3916 100644 --- a/gtsam/geometry/Cal3Unified.h +++ b/gtsam/geometry/Cal3Unified.h @@ -47,11 +47,10 @@ class GTSAM_EXPORT Cal3Unified : public Cal3DS2_Base { private: double xi_; // mirror parameter - static const size_t dimension_ = 10; public: - enum { dimension = dimension_ }; + enum { dimension = 10 }; /// @name Standard Constructors /// @{ @@ -119,10 +118,10 @@ public: Vector10 localCoordinates(const Cal3Unified& T2) const ; /// Return dimensions of calibration manifold object - virtual size_t dim() const { return dimension_ ; } + virtual size_t dim() const { return dimension ; } /// Return dimensions of calibration manifold object - static size_t Dim() { return dimension_; } + static size_t Dim() { return dimension; } /// Return all parameters as a vector Vector10 vector() const ; diff --git a/gtsam/geometry/Cal3_S2.h b/gtsam/geometry/Cal3_S2.h index fdf3b7d28..f2848d0a3 100644 --- a/gtsam/geometry/Cal3_S2.h +++ b/gtsam/geometry/Cal3_S2.h @@ -33,10 +33,9 @@ namespace gtsam { class GTSAM_EXPORT Cal3_S2 { private: double fx_, fy_, s_, u0_, v0_; - static const size_t dimension_ = 5; public: - enum { dimension = dimension_ }; + enum { dimension = 5 }; typedef boost::shared_ptr shared_ptr; ///< shared pointer to calibration object /// @name Standard Constructors @@ -194,14 +193,10 @@ public: /// @{ /// return DOF, dimensionality of tangent space - inline size_t dim() const { - return dimension_; - } + inline size_t dim() const { return dimension; } /// return DOF, dimensionality of tangent space - static size_t Dim() { - return dimension_; - } + static size_t Dim() { return dimension; } /// Given 5-dim tangent vector, create new calibration inline Cal3_S2 retract(const Vector& d) const { diff --git a/gtsam/geometry/Cal3_S2Stereo.h b/gtsam/geometry/Cal3_S2Stereo.h index fc85d9d36..a6eb41b60 100644 --- a/gtsam/geometry/Cal3_S2Stereo.h +++ b/gtsam/geometry/Cal3_S2Stereo.h @@ -32,11 +32,10 @@ namespace gtsam { Cal3_S2 K_; double b_; - static const size_t dimension_ = 6; public: - enum { dimension = dimension_ }; + enum { dimension = 6 }; typedef boost::shared_ptr shared_ptr; ///< shared pointer to stereo calibration object /// @name Standard Constructors @@ -112,14 +111,10 @@ namespace gtsam { /// @{ /// return DOF, dimensionality of tangent space - inline size_t dim() const { - return dimension_; - } + inline size_t dim() const { return dimension; } /// return DOF, dimensionality of tangent space - static size_t Dim() { - return dimension_; - } + static size_t Dim() { return dimension; } /// Given 6-dim tangent vector, create new calibration inline Cal3_S2Stereo retract(const Vector& d) const { diff --git a/gtsam/geometry/CalibratedCamera.h b/gtsam/geometry/CalibratedCamera.h index 2ee5266a7..eff747eb5 100644 --- a/gtsam/geometry/CalibratedCamera.h +++ b/gtsam/geometry/CalibratedCamera.h @@ -248,14 +248,10 @@ private: */ class GTSAM_EXPORT CalibratedCamera: public PinholeBase { -private: - - static const size_t dimension_ = 6; - public: enum { - dimension = dimension_ + dimension = 6 }; /// @name Standard Constructors @@ -330,12 +326,12 @@ public: /// @deprecated inline size_t dim() const { - return dimension_; + return dimension; } /// @deprecated inline static size_t Dim() { - return dimension_; + return dimension; } /// @}