From 283932ae68b9697e00cde36b2bdba22827e8f69c Mon Sep 17 00:00:00 2001 From: Dan McGann Date: Sun, 9 Apr 2023 11:38:40 -0400 Subject: [PATCH] Convert Pose2 r/t accessors to inline --- gtsam/geometry/Pose2.cpp | 15 --------------- gtsam/geometry/Pose2.h | 13 +++++++++++-- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gtsam/geometry/Pose2.cpp b/gtsam/geometry/Pose2.cpp index 9903a529f..b37674b92 100644 --- a/gtsam/geometry/Pose2.cpp +++ b/gtsam/geometry/Pose2.cpp @@ -32,21 +32,6 @@ GTSAM_CONCEPT_POSE_INST(Pose2) static const Rot2 R_PI_2(Rot2::fromCosSin(0., 1.)); -/* ************************************************************************* */ -const Point2 &Pose2::translation(OptionalJacobian<2, 3> Hself) const { - if (Hself) { - *Hself = Matrix::Zero(2, 3); - (*Hself).block<2, 2>(0, 0) = rotation().matrix(); - } - return t_; -} - -/* ************************************************************************* */ -const Rot2& Pose2::rotation(OptionalJacobian<1, 3> Hself) const { - if (Hself) *Hself << 0, 0, 1; - return r_; -} - /* ************************************************************************* */ Matrix3 Pose2::matrix() const { Matrix2 R = r_.matrix(); diff --git a/gtsam/geometry/Pose2.h b/gtsam/geometry/Pose2.h index bf3081339..e59261544 100644 --- a/gtsam/geometry/Pose2.h +++ b/gtsam/geometry/Pose2.h @@ -255,10 +255,19 @@ public: inline const Rot2& r() const { return rotation(); } /// translation - const Point2& translation(OptionalJacobian<2, 3> Hself={}) const; + inline const Point2& translation(OptionalJacobian<2, 3> Hself={}) const { + if (Hself) { + *Hself = Matrix::Zero(2, 3); + (*Hself).block<2, 2>(0, 0) = rotation().matrix(); + } + return t_; + } /// rotation - const Rot2& rotation(OptionalJacobian<1, 3> Hself={}) const; + inline const Rot2& rotation(OptionalJacobian<1, 3> Hself={}) const { + if (Hself) *Hself << 0, 0, 1; + return r_; + } //// return transformation matrix GTSAM_EXPORT Matrix3 matrix() const;