]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add width with mirrors
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 17:50:45 +0000 (18:50 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 17:50:45 +0000 (18:50 +0100)
incl/bcar.hh
src/bcar.cc

index 9e709862d99495139a56debba759425175f76225..cf2020fbce5c1d5123a42e6245b2ca14b8024543 100644 (file)
@@ -201,7 +201,8 @@ public:
 class CarSize {
 private:
        double _curb_to_curb = 10.802166641822163;
-       double _width = 1.945; // including mirrors
+       double _width_with_mirrors = 1.945;
+       double _width = 1.771;
        double _wheelbase = 2.588;
        double _distance_to_front = 3.427;
        double _length = 4.084;
@@ -225,6 +226,12 @@ public:
        /*! Set width. */
        void w(double w);
 
+       /*! Get width with mirrors. */
+       double wwm() const;
+
+       /*! Set width with mirrors. */
+       void wwm(double w);
+
        /*! Get length. */
        double len() const;
 
@@ -417,6 +424,24 @@ public:
        /*! Get frame's right front axle point. */
        Point rfa() const;
 
+       /*! Get frame's left front mirror x coordinate. */
+       double lfmx() const;
+
+       /*! Get frame's left front mirror y coordinate. */
+       double lfmy() const;
+
+       /*! Get frame's right front mirror x coordinate. */
+       double rfmx() const;
+
+       /*! Get frame's right front mirror y coordinate. */
+       double rfmy() const;
+
+       /*! Get iframe's left front mirror point. */
+       Point lfm() const;
+
+       /*! Get frame's right front mirror point. */
+       Point rfm() const;
+
        /*! Get frame's center front x coordinate. */
        double cfx() const;
 
index d5b6b020e19d0a08440ee335812aab5fb13d067f..1e205a7f1a1d51ffafa683c5c1a03343058fc49e 100644 (file)
@@ -465,6 +465,18 @@ CarSize::w(double w)
        this->_width = w;
 }
 
+double
+CarSize::wwm() const
+{
+       return this->_width_with_mirrors;
+}
+
+void
+CarSize::wwm(double w)
+{
+       this->_width_with_mirrors = w;
+}
+
 double
 CarSize::len() const
 {
@@ -543,7 +555,7 @@ CarSize::perfect_parking_slot_len() const
        auto r = this->ctc() / 2.0;
        auto l = this->wb();
        auto k = this->df() - this->wb();
-       auto w = this->w();
+       auto w = this->w(); // FIXME use wwm()?
        auto r2l2 = r * r - l * l;
        auto s = r2l2 + pow(l + k, 2.0) - pow(sqrt(r2l2) - w, 2.0);
        return this->len() + sqrt(s) - l - k;
@@ -868,6 +880,54 @@ BicycleCar::rfa() const
        return Point(this->rfax(), this->rfay());
 }
 
+double
+BicycleCar::lfmx() const
+{
+       double x = this->x();
+       x += (this->wwm() / 2.0) * cos(this->h() + M_PI / 2.0);
+       x += this->wb() * cos(this->h());
+       return x;
+}
+
+double
+BicycleCar::lfmy() const
+{
+       double y = this->y();
+       y += (this->wwm() / 2.0) * sin(this->h() + M_PI / 2.0);
+       y += this->wb() * sin(this->h());
+       return y;
+}
+
+double
+BicycleCar::rfmx() const
+{
+       double x = this->x();
+       x += (this->wwm() / 2.0) * cos(this->h() - M_PI / 2.0);
+       x += this->wb() * cos(this->h());
+       return x;
+}
+
+double
+BicycleCar::rfmy() const
+{
+       double y = this->y();
+       y += (this->wwm() / 2.0) * sin(this->h() - M_PI / 2.0);
+       y += this->wb() * sin(this->h());
+       return y;
+}
+
+Point
+BicycleCar::lfm() const
+{
+       return Point(this->lfmx(), this->lfmy());
+}
+
+Point
+BicycleCar::rfm() const
+{
+       return Point(this->rfmx(), this->rfmy());
+}
+
 double
 BicycleCar::cfx() const
 {