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;
/*! 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;
/*! 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;
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
{
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;
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
{