From: Jiri Vlasak Date: Wed, 19 Jan 2022 17:09:07 +0000 (+0100) Subject: Add frame points getters, unify naming X-Git-Tag: v0.9.0~5^2~2 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/bcar.git/commitdiff_plain/7bd990cd8b3091a3c7305bfb75dd5690f24fc1d5 Add frame points getters, unify naming --- diff --git a/incl/bcar.hh b/incl/bcar.hh index 7302855..9e70986 100644 --- a/incl/bcar.hh +++ b/incl/bcar.hh @@ -381,17 +381,50 @@ public: /*! Get frame's front side. */ Line front() const; - /*! Get rear axle's left x coordinate. */ - double ralx() const; + /*! Get frame's left rear axle x coordinate. */ + double lrax() const; - /*! Get rear axle's left y coordinate. */ - double raly() const; + /*! Get frame's left rear axle y coordinate. */ + double lray() const; - /*! Get rear axle's right x coordinate. */ - double rarx() const; + /*! Get frame's right rear axle x coordinate. */ + double rrax() const; - /*! Get rear axle's right y coordinate. */ - double rary() const; + /*! Get frame's right rear axle y coordinate. */ + double rray() const; + + /*! Get frame's left rear axle point. */ + Point lra() const; + + /*! Get frame's right rear axle point. */ + Point rra() const; + + /*! Get frame's left front axle x coordinate. */ + double lfax() const; + + /*! Get frame's left front axle y coordinate. */ + double lfay() const; + + /*! Get frame's right front axle x coordinate. */ + double rfax() const; + + /*! Get frame's right front axle y coordinate. */ + double rfay() const; + + /*! Get iframe's left front axle point. */ + Point lfa() const; + + /*! Get frame's right front axle point. */ + Point rfa() const; + + /*! Get frame's center front x coordinate. */ + double cfx() const; + + /*! Get frame's center front y coordinate. */ + double cfy() const; + + /*! Get frame's center front point. */ + Point cf() const; /*! Min. turning radius circle center on left. */ Point ccl() const; diff --git a/src/bcar.cc b/src/bcar.cc index b5446e0..d5b6b02 100644 --- a/src/bcar.cc +++ b/src/bcar.cc @@ -790,14 +790,14 @@ BicycleCar::front() const } double -BicycleCar::ralx() const +BicycleCar::lrax() const { double lrx = this->x(); lrx += (this->w() / 2.0) * cos(this->h() + M_PI / 2.0); return lrx; } double -BicycleCar::raly() const +BicycleCar::lray() const { double lry = this->y(); lry += (this->w() / 2.0) * sin(this->h() + M_PI / 2.0); @@ -805,7 +805,7 @@ BicycleCar::raly() const } double -BicycleCar::rarx() const +BicycleCar::rrax() const { double rrx = this->x(); rrx += (this->w() / 2.0) * cos(this->h() - M_PI / 2.0); @@ -813,13 +813,79 @@ BicycleCar::rarx() const } double -BicycleCar::rary() const +BicycleCar::rray() const { double rry = this->y(); rry += (this->w() / 2.0) * sin(this->h() - M_PI / 2.0); return rry; } +Point +BicycleCar::lra() const +{ + return Point(this->lrax(), this->lray()); +} + +Point +BicycleCar::rra() const +{ + return Point(this->rrax(), this->rray()); +} + +double +BicycleCar::lfax() const +{ + return this->lrax() + this->wb() * cos(this->h()); +} + +double +BicycleCar::lfay() const +{ + return this->lray() + this->wb() * sin(this->h()); +} + +double +BicycleCar::rfax() const +{ + return this->rrax() + this->wb() * cos(this->h()); +} + +double +BicycleCar::rfay() const +{ + return this->rray() + this->wb() * sin(this->h()); +} + +Point +BicycleCar::lfa() const +{ + return Point(this->lfax(), this->lfay()); +} + +Point +BicycleCar::rfa() const +{ + return Point(this->rfax(), this->rfay()); +} + +double +BicycleCar::cfx() const +{ + return this->x() + this->df() * cos(this->h()); +} + +double +BicycleCar::cfy() const +{ + return this->y() + this->df() * sin(this->h()); +} + +Point +BicycleCar::cf() const +{ + return Point(this->cfx(), this->cfy()); +} + Point BicycleCar::ccl() const { diff --git a/ut/bcar.t.cc b/ut/bcar.t.cc index 73aaaef..1f3bc85 100644 --- a/ut/bcar.t.cc +++ b/ut/bcar.t.cc @@ -33,10 +33,10 @@ WVTEST_MAIN("bcar basic geometry") WVPASSEQ_DOUBLE(0.5, bc.lry(), 0.00001); WVPASSEQ_DOUBLE(0.5, bc.rry(), 0.00001); WVPASSEQ_DOUBLE(3.5, bc.rfy(), 0.00001); - WVPASSEQ_DOUBLE(0.5, bc.ralx(), 0.00001); - WVPASSEQ_DOUBLE(1.5, bc.rarx(), 0.00001); - WVPASSEQ_DOUBLE(1.0, bc.raly(), 0.00001); - WVPASSEQ_DOUBLE(1.0, bc.rary(), 0.00001); + WVPASSEQ_DOUBLE(0.5, bc.lrax(), 0.00001); + WVPASSEQ_DOUBLE(1.5, bc.rrax(), 0.00001); + WVPASSEQ_DOUBLE(1.0, bc.lray(), 0.00001); + WVPASSEQ_DOUBLE(1.0, bc.rray(), 0.00001); // min. turning radius circle centers WVPASSEQ_DOUBLE(bc.h(), M_PI / 2.0, 0.00001);