+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)
+{
+ if (opts.ALL) {
+ opts.CAR = true;
+ opts.MIRRORS = true;
+ }
+ if (opts.MIRRORS) {
+ opts.LEFT_MIRROR = true;
+ opts.RIGHT_MIRROR = true;
+ }
+ if (opts.CAR) {
+ opts.FRAME = true;
+ opts.CROSS = true;
+ opts.ARROW = true;
+ }
+ if (opts.FRAME) {
+ opts.LEFT = true;
+ opts.RIGHT = true;
+ opts.REAR = true;
+ opts.FRONT = true;
+ }
+ if (opts.LEFT) {
+ this->lf().gen_gnuplot_to(out);
+ this->lr().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+ if (opts.RIGHT) {
+ this->rf().gen_gnuplot_to(out);
+ this->rr().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+ if (opts.REAR) {
+ this->lr().gen_gnuplot_to(out);
+ this->rr().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+ if (opts.FRONT) {
+ this->lf().gen_gnuplot_to(out);
+ this->rf().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+ if (opts.ARROW) {
+ this->cf().gen_gnuplot_to(out);
+ this->lfa().gen_gnuplot_to(out);
+ this->rfa().gen_gnuplot_to(out);
+ this->cf().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+ if (opts.CROSS) {
+ double lx = this->x() + 0.2 * cos(this->h() + M_PI/2);
+ double rx = this->x() - 0.2 * cos(this->h() + M_PI/2);
+ double fx = this->x() + 0.2 * cos(this->h());
+ double bx = this->x() - 0.2 * cos(this->h()); // rear is back
+ double ly = this->y() + 0.2 * sin(this->h() + M_PI/2);
+ double ry = this->y() - 0.2 * sin(this->h() + M_PI/2);
+ double fy = this->y() + 0.2 * sin(this->h());
+ double by = this->y() - 0.2 * sin(this->h()); // rear is back
+ out << lx << " " << ly << std::endl;
+ out << rx << " " << ry << std::endl;
+ out << std::endl;
+ out << fx << " " << fy << std::endl;
+ out << bx << " " << by << std::endl;
+ out << std::endl;
+ }
+ if (opts.LEFT_MIRROR) {
+ this->lf().gen_gnuplot_to(out);
+ this->lfm().gen_gnuplot_to(out);
+ this->lr().gen_gnuplot_to(out);
+ out << std::endl;
+
+ }
+ if (opts.RIGHT_MIRROR) {
+ this->rf().gen_gnuplot_to(out);
+ this->rfm().gen_gnuplot_to(out);
+ this->rr().gen_gnuplot_to(out);
+ out << std::endl;
+ }
+}
+