]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Make gen plot opts non-constant, plot points
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 21:23:05 +0000 (22:23 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 21:23:17 +0000 (22:23 +0100)
incl/bcar.hh
src/bcar.cc

index d6b764cb64e9814d43e8183e13874f44f0f0e6cb..018415d96e78df321634ab544e7bb874fda17717 100644 (file)
@@ -480,22 +480,29 @@ public:
        /*! Options for generating output for gnuplot. */
        class GenPlotOpts {
        public:
-               static bool LEFT;
-               static bool RIGHT;
-               static bool REAR;
-               static bool FRONT;
-               static bool FRAME;
-               static bool ARROW;
-               static bool CROSS;
-               static bool CAR;
-               static bool LEFT_MIRROR;
-               static bool RIGHT_MIRROR;
-               static bool MIRRORS;
-               static bool ALL;
+               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 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 const& opts);
+       void gen_gnuplot_to(std::ostream& out, GenPlotOpts opts);
 };
 
 } // namespace bcar
index 59fbb613f917c650e8544234abb4bfab6d5f704c..720057929894e40ababb4897f8142ab2987ac2a5 100644 (file)
@@ -994,21 +994,8 @@ BicycleCar::next()
        this->h(this->h() + this->sp() / this->wb() * tan(this->st()));
 }
 
-bool BicycleCar::GenPlotOpts::LEFT = false;
-bool BicycleCar::GenPlotOpts::RIGHT = false;
-bool BicycleCar::GenPlotOpts::REAR = false;
-bool BicycleCar::GenPlotOpts::FRONT = false;
-bool BicycleCar::GenPlotOpts::FRAME = false; // LEFT, RIGHT, REAR, FRONT
-bool BicycleCar::GenPlotOpts::ARROW = false;
-bool BicycleCar::GenPlotOpts::CROSS = false;
-bool BicycleCar::GenPlotOpts::CAR = false; // CROSS, ARROW, FRAME
-bool BicycleCar::GenPlotOpts::LEFT_MIRROR = false;
-bool BicycleCar::GenPlotOpts::RIGHT_MIRROR = false;
-bool BicycleCar::GenPlotOpts::MIRRORS = false; // RIGHT_MIRROR, LEFT_MIRROR
-bool BicycleCar::GenPlotOpts::ALL = true; // MIRRORS, CAR
-
 void
-BicycleCar::gen_gnuplot_to(std::ostream& out, GenPlotOpts const& opts)
+BicycleCar::gen_gnuplot_to(std::ostream& out, GenPlotOpts opts)
 {
        if (opts.ALL) {
                opts.CAR = true;
@@ -1029,6 +1016,24 @@ BicycleCar::gen_gnuplot_to(std::ostream& out, GenPlotOpts const& opts)
                opts.REAR = true;
                opts.FRONT = true;
        }
+       if (opts.LF_POINT) {
+               this->lf().gen_gnuplot_to(out);
+       }
+       if (opts.LR_POINT) {
+               this->lr().gen_gnuplot_to(out);
+       }
+       if (opts.RR_POINT) {
+               this->rr().gen_gnuplot_to(out);
+       }
+       if (opts.RF_POINT) {
+               this->rf().gen_gnuplot_to(out);
+       }
+       if (opts.LFM_POINT) {
+               this->lfm().gen_gnuplot_to(out);
+       }
+       if (opts.RFM_POINT) {
+               this->rfm().gen_gnuplot_to(out);
+       }
        if (opts.LEFT) {
                this->lf().gen_gnuplot_to(out);
                this->lr().gen_gnuplot_to(out);