From aba3f5e9f67e4acd7de9e8d6d86c54a9f04aff84 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Wed, 14 Jul 2021 22:53:24 +0200 Subject: [PATCH] Inherit pose from point --- incl/bcar.hh | 17 +++-------------- src/bcar.cc | 20 ++------------------ 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/incl/bcar.hh b/incl/bcar.hh index 9f5017e..1e0b61b 100644 --- a/incl/bcar.hh +++ b/incl/bcar.hh @@ -103,23 +103,12 @@ public: }; /*! Store coordinates `x`, `y`, and heading `h`. */ -class Pose { +class Pose : public Point { private: - double x_ = 0.0; - double y_ = 0.0; double h_ = 0.0; public: - /*! Get horizontal coordinate. */ - double x() const; - - /*! Set horizontal coordinate. */ - void x(double x); - - /*! Get vertical coordinate. */ - double y() const; - - /*! Set vertical coordinate. */ - void y(double y); + Pose(double x, double y, double h); + Pose(); /*! Get heading in the interval [-pi, +pi] radians. */ double h() const; diff --git a/src/bcar.cc b/src/bcar.cc index 44a593a..75f220c 100644 --- a/src/bcar.cc +++ b/src/bcar.cc @@ -191,28 +191,12 @@ Line::is_on_right_side(Point const& p) const } } -double -Pose::x() const -{ - return this->x_; -} - -void -Pose::x(double x) -{ - this->x_ = x; -} - -double -Pose::y() const +Pose::Pose() : Point() { - return this->y_; } -void -Pose::y(double y) +Pose::Pose(double x, double y, double h) : Point(x, y), h_(h) { - this->y_ = y; } double -- 2.39.2