diff --git a/cpp/Point3.h b/cpp/Point3.h index 48350edc5..b4baaddbe 100644 --- a/cpp/Point3.h +++ b/cpp/Point3.h @@ -46,9 +46,9 @@ namespace gtsam { } /** get functions for x, y, z */ - double x() const {return x_;} - double y() const {return y_;} - double z() const {return z_;} + inline double x() const {return x_;} + inline double y() const {return y_;} + inline double z() const {return z_;} /** operators */ Point3 operator - () const { return Point3(-x_,-y_,-z_);} diff --git a/cpp/Pose2.h b/cpp/Pose2.h index d6e634fb8..3be38d09e 100644 --- a/cpp/Pose2.h +++ b/cpp/Pose2.h @@ -56,11 +56,12 @@ namespace gtsam { Matrix matrix() const; /** get functions for x, y, theta */ - double x() const { return t_.x(); } - double y() const { return t_.y(); } - double theta() const { return r_.theta(); } - Point2 t() const { return t_; } - Rot2 r() const { return r_; } + inline double x() const { return t_.x(); } + inline double y() const { return t_.y(); } + inline double theta() const { return r_.theta(); } + + inline const Point2& t() const { return t_; } + inline const Rot2& r() const { return r_; } static inline size_t dim() { return 3; }; diff --git a/cpp/Pose3.h b/cpp/Pose3.h index ae5d31c4f..106e882c5 100644 --- a/cpp/Pose3.h +++ b/cpp/Pose3.h @@ -43,12 +43,12 @@ namespace gtsam { R_(V(0), V(3), V(6), V(1), V(4), V(7), V(2), V(5), V(8)), t_(V(9), V(10),V(11)) {} - const Rot3& rotation() const { return R_; } + inline const Rot3& rotation() const { return R_; } + inline const Point3& translation() const { return t_; } - const Point3& translation() const { return t_; } - double x() const { return t_.x(); } - double y() const { return t_.y(); } - double z() const { return t_.z(); } + inline double x() const { return t_.x(); } + inline double y() const { return t_.y(); } + inline double z() const { return t_.z(); } /** convert to 4*4 matrix */ Matrix matrix() const; diff --git a/cpp/Rot2.h b/cpp/Rot2.h index b6a885a65..40e3858a3 100644 --- a/cpp/Rot2.h +++ b/cpp/Rot2.h @@ -25,8 +25,9 @@ namespace gtsam { public: /** constructor from cos/sin */ - Rot2(double c, double s) : + inline Rot2(double c, double s) : c_(c), s_(s) { +#ifdef ROT2_RENORMALIZE // rtodo: Could do this scale correction only when creating from compose // Don't let scale drift double scale = c*c + s*s; @@ -35,6 +36,7 @@ namespace gtsam { c_ *= scale; s_ *= scale; } +#endif } /** default constructor, zero rotation */ @@ -47,10 +49,10 @@ namespace gtsam { double theta() const { return atan2(s_,c_); } /** return cos */ - double c() const { return c_; } + inline double c() const { return c_; } /** return sin */ - double s() const { return s_; } + inline double s() const { return s_; } /** print */ void print(const std::string& s = "theta") const;