2 * SPDX-FileCopyrightText: 2021 Jiri Vlasak <jiri.vlasak.2@cvut.cz>
4 * SPDX-License-Identifier: GPL-3.0-only
16 #define INIT_V vector<M> V;
17 #define P(W) V.push_back(M(#W)); V.back().o.W = true;
19 #define A {}// P(CAR_POINT) LC = c;
23 static unsigned int cntr;
28 bcar::BicycleCar::GenPlotOpts o;
32 this->c.gen_gnuplot_to(this->f, this->o);
40 M(std::string fn) : fn(fn)
42 this->fc = std::to_string(this->cntr++);
43 this->f.open(this->fn + this->fc);
46 M(M const& m) : fn(m.fn), c(m.c), o(m.o)
48 this->fc = std::to_string(this->cntr++);
49 this->f.open(this->fn + this->fc);
56 friend void swap(M& f, M& t)
65 f.f.open(f.fn + f.fc);
66 t.f.open(t.fn + t.fc);
73 unsigned int M::cntr = 10;
76 gpl_slot(bcar::ParkingSlot& s, std::string fn = "")
78 if (fn.compare("") == 0) {
89 gen_pl_script(std::vector<M>& ms, std::string with_slot)
94 f << "#!/usr/bin/gnuplot" << endl;
95 f << "set terminal pdf size 16,9 enhance color lw 4" << endl;
96 f << "set output 'out.pdf'" << endl;
97 f << "unset key" << endl;
98 f << "set size ratio -1" << endl;
99 f << "set xrange [-9.5:9.9]" << endl;
100 f << "set yrange [-2.8:5.9]" << endl;
101 if (with_slot.compare("") != 0) {
102 f << "plot '" << with_slot << "' w l lc 'blue',";
107 f << " '" << (m.fn + m.fc) << "'" << " w l lc 'red',";
110 //f << "pause -1" << endl;
115 main(int argc, char **argv)
119 cerr << "Specify `what_plot` number." << endl;
120 // what_plot values 50 - 72 correspond to OSP
126 bcar::ParkingSlot s(bcar::Point(0, 0), 0, 2.5, 6);
130 s.fe(bcar::BicycleCar());
133 int what_plot = atoi(argv[1]);
138 int len = s._ispaths.size();
139 auto c = s._ispaths[len / 2].front();
143 if (what_plot > 52) {
146 for (int i = 0; i < 5; i++) {
151 if (what_plot > 54) { // can go anywhere forward
154 while (!s.lf().inside_of(c.ccr(), c.iradi())) {
159 if (what_plot > 55) {
161 for (int i = 0; i < 10; i++) {
166 if (what_plot > 56) {
168 for (int i = 0; i < 10; i++) {
173 if (what_plot > 57) {
175 for (int i = 0; i < 10; i++) {
180 if (what_plot > 58) { // few steps towards -- most up
182 for (int i = 0; i < 10; i++) {
187 if (what_plot > 60) {
190 for (int i = 0; i < 10; i++) {
195 if (what_plot > 61) {
198 for (int i = 0; i < 10; i++) {
203 if (what_plot > 62) { // parallel to ps
206 for (int i = 0; i < 10; i++) {
211 if (what_plot > 66) { // what_plot should be up to 22 (init)
212 int how_much = what_plot - 16 - 50;
215 for (int i = 0; i < 20 * how_much; i++) {
226 gen_pl_script(V, sn);
227 cout << "mv out.pdf " << ((what_plot < 10)?"0":"");
228 cout << what_plot << ".pdf" << endl;