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);
};
*/
PoseRange recompute_entry(PoseRange p);
+ /*! Generate output for plotting with gnuplot. */
+ void gen_gnuplot_to(std::ostream& out);
+
friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s);
};
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)
{
};
void
-gen_pl_script(std::vector<M>& ms)
+gpl_slot(bcar::ParkingSlot& s, std::string fn)
+{
+ if (fn.compare("") == 0) {
+ return;
+ }
+ using namespace std;
+ ofstream f;
+ f.open(fn);
+ s.gen_gnuplot_to(f);
+ f.close();
+}
+
+void
+gen_pl_script(std::vector<M>& ms, std::string with_slot)
{
using namespace std;
ofstream f;
for (auto& m: ms) {
f << " '" << m.fn << "'" << " w l,";
}
+ if (with_slot.compare("") != 0) {
+ f << " '" << with_slot << "' w l";
+ }
f << endl;
f << "pause -1" << endl;
f.close();
cout << fixed;
cerr << fixed;
+ bcar::ParkingSlot s(bcar::Point(0, 0), 0, 2.5, 6);
+ string sn("slot");
+ gpl_slot(s, sn);
+
INIT_V
P(LF_POINT)
P(LFM_POINT)
m.gpl();
}
}
- gen_pl_script(V);
+ gen_pl_script(V, sn);
return 0;
}
return p;
}
+void
+ParkingSlot::gen_gnuplot_to(std::ostream& out)
+{
+ this->rear().gen_gnuplot_to(out);
+ this->curb().gen_gnuplot_to(out);
+ this->front().gen_gnuplot_to(out);
+}
+
std::ostream&
operator<<(std::ostream& o, ParkingSlot const& s)
{