]> 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 4e635d6c395a9a8f72519f1c94ea6d2fb7b5252b..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
 {