]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - src/bcar.cc
Merge branch 'improve-plot'
[hubacji1/bcar.git] / src / bcar.cc
index 59fbb613f917c650e8544234abb4bfab6d5f704c..4e635d6c395a9a8f72519f1c94ea6d2fb7b5252b 100644 (file)
@@ -270,6 +270,14 @@ Line::h() const
        return atan2(this->_e.y() - this->_b.y(), this->_e.x() - this->_b.x());
 }
 
+void
+Line::gen_gnuplot_to(std::ostream& out)
+{
+       this->b().gen_gnuplot_to(out);
+       this->e().gen_gnuplot_to(out);
+       out << std::endl;
+}
+
 std::ostream&
 operator<<(std::ostream& out, Line const& li)
 {
@@ -994,21 +1002,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 +1024,33 @@ 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.CRA_POINT || opts.CAR_POINT) {
+               Point::gen_gnuplot_to(out);
+       }
+       if (opts.LRA_POINT) {
+               this->lra().gen_gnuplot_to(out);
+       }
+       if (opts.RRA_POINT) {
+               this->rra().gen_gnuplot_to(out);
+       }
        if (opts.LEFT) {
                this->lf().gen_gnuplot_to(out);
                this->lr().gen_gnuplot_to(out);