]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add frame points getters, unify naming
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 17:09:07 +0000 (18:09 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 17:09:07 +0000 (18:09 +0100)
incl/bcar.hh
src/bcar.cc
ut/bcar.t.cc

index 7302855583bf25002b4921c69eb9d94a022c5574..9e709862d99495139a56debba759425175f76225 100644 (file)
@@ -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;
index b5446e037569fd99d5c275871c5365cb02811f82..d5b6b020e19d0a08440ee335812aab5fb13d067f 100644 (file)
@@ -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
 {
index 73aaaefc5518b8e0fafe32982813a091d6288903..1f3bc854078aa6640a9fa5ebd22ead8af160b801 100644 (file)
@@ -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);