]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - incl/bcar.hh
Extend gen plot for parking slot
[hubacji1/bcar.git] / incl / bcar.hh
index 7302855583bf25002b4921c69eb9d94a022c5574..c2265a59c566c9ac56332b70bae0dc167e1eace7 100644 (file)
@@ -86,6 +86,9 @@ public:
        /*! Return Euclidean distance to `p`. */
        double edist(Point const& p) const;
 
+       /*! Generate output for plotting with gnuplot. */
+       void gen_gnuplot_to(std::ostream& out);
+
        bool operator==(Point const& p);
        friend std::ostream& operator<<(std::ostream& out, Point const& p);
 };
@@ -141,6 +144,9 @@ public:
 
        double h() const;
 
+       /*! Generate output for plotting with gnuplot. */
+       void gen_gnuplot_to(std::ostream& out);
+
        friend std::ostream& operator<<(std::ostream& out, Line const& li);
 };
 
@@ -201,7 +207,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 +232,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;
 
@@ -283,6 +296,20 @@ public:
         */
        double orradi() const;
 
+       /*! \brief Return inner mirror radius.
+        *
+        * The inner mirror radius is the distance from minimum turning radius
+        * circle center to the farther mirror (from the rear axle view).
+        */
+       double imradi() const;
+
+       /*! \brief Return outer mirror radius.
+        *
+        * The outer mirror radius is the distance from minimum turning radius
+        * circle center to the farther mirror (from the rear axle view).
+        */
+       double omradi() const;
+
        /*! \brief Return length of perfect parking slot.
         *
         * The width of the slot is the same as the width of the car.
@@ -381,17 +408,68 @@ 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 frame's left rear axle y coordinate. */
+       double lray() const;
+
+       /*! Get frame's right rear axle x coordinate. */
+       double rrax() const;
+
+       /*! Get frame's right rear axle y coordinate. */
+       double rray() const;
+
+       /*! Get frame's left rear axle point. */
+       Point lra() const;
 
-       /*! Get rear axle's left y coordinate. */
-       double raly() const;
+       /*! Get frame's right rear axle point. */
+       Point rra() const;
 
-       /*! Get rear axle's right x coordinate. */
-       double rarx() const;
+       /*! Get frame's left front axle x coordinate. */
+       double lfax() const;
 
-       /*! Get rear axle's right y coordinate. */
-       double rary() 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 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;
+
+       /*! 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;
@@ -401,6 +479,35 @@ public:
 
        /*! Next car position based on speed `sp` and steer `st`. */
        void next();
+
+       /*! Options for generating output for gnuplot. */
+       class GenPlotOpts {
+       public:
+               bool LF_POINT = false;
+               bool LR_POINT = false;
+               bool RR_POINT = false;
+               bool RF_POINT = false;
+               bool LFM_POINT = false;
+               bool RFM_POINT = false;
+               bool CRA_POINT = false;
+               bool CAR_POINT = false;
+
+               bool LEFT = false;
+               bool RIGHT = false;
+               bool REAR = false;
+               bool FRONT = false;
+               bool FRAME = false; // LEFT, RIGHT, REAR, FRONT
+               bool ARROW = false;
+               bool CROSS = false;
+               bool CAR = false; // CROSS, ARROW, FRAME
+               bool LEFT_MIRROR = false;
+               bool RIGHT_MIRROR = false;
+               bool MIRRORS = false; // RIGHT_MIRROR, LEFT_MIRROR
+               bool ALL = true; // MIRRORS, CAR
+       };
+
+       /*! Generate output for plotting with gnuplot. */
+       void gen_gnuplot_to(std::ostream& out, GenPlotOpts opts);
 };
 
 } // namespace bcar