From: Jiri Vlasak Date: Wed, 19 Jan 2022 17:50:45 +0000 (+0100) Subject: Add width with mirrors X-Git-Tag: v0.9.0~5^2~1 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/bcar.git/commitdiff_plain/d504fa83fcd1c1c6a7600593ca3c817e468aaf03 Add width with mirrors --- diff --git a/incl/bcar.hh b/incl/bcar.hh index 9e70986..cf2020f 100644 --- a/incl/bcar.hh +++ b/incl/bcar.hh @@ -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; diff --git a/src/bcar.cc b/src/bcar.cc index d5b6b02..1e205a7 100644 --- a/src/bcar.cc +++ b/src/bcar.cc @@ -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 {