]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - src/bcar.cc
Add edist to rr, lf method
[hubacji1/bcar.git] / src / bcar.cc
index 4c8307c42f5a442702ff3fcb24706d7723b9ab4a..350d1afc144ac2954e5ca381c81018c35fecab16 100644 (file)
@@ -85,6 +85,14 @@ Point::inside_of(std::vector<Point> const& poly) const
        return c;
 }
 
+bool
+Point::inside_of(Point const& c, double const r) const
+{
+       double dx = this->x() - c.x();
+       double dy = this->y() - c.y();
+       return pow(dx, 2.0) + pow(dy, 2.0) < pow(r, 2.0);
+}
+
 bool
 Point::on_right_side_of(Line const& li) const
 {
@@ -533,6 +541,18 @@ CarSize::ft() const
        return this->_front_track;
 }
 
+double
+CarSize::edist_to_rr() const
+{
+       return sqrt(pow(this->w() / 2.0, 2) + pow(this->len() - this->df(), 2));
+}
+
+double
+CarSize::edist_to_lf() const
+{
+       return sqrt(pow(this->w() / 2.0, 2) + pow(this->df(), 2));
+}
+
 double
 CarSize::mtr() const
 {
@@ -1045,6 +1065,12 @@ BicycleCar::gen_gnuplot_to(std::ostream& out, GenPlotOpts opts)
        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);