]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - src/bcar.cc
Add car frame point and side getters
[hubacji1/bcar.git] / src / bcar.cc
index 7c8dd93f6fab1da00e9f590890a911ef1c14757e..32b2b8869ded7e6a1ec7ea3dcae717e1198ef43e 100644 (file)
@@ -108,6 +108,12 @@ Point::rotate(Point const& c, double const angl)
        this->y(ny + c.y());
 }
 
+double
+Point::edist(Point const& p) const
+{
+       return sqrt(pow(p.x() - this->x_, 2.0) + pow(p.y() - this->y_, 2.0));
+}
+
 std::ostream&
 operator<<(std::ostream& out, Point const& p)
 {
@@ -625,6 +631,54 @@ BicycleCar::rfy() const
        return rfy;
 }
 
+Point
+BicycleCar::lf() const
+{
+       return Point(this->lfx(), this->lfy());
+}
+
+Point
+BicycleCar::lr() const
+{
+       return Point(this->lrx(), this->lry());
+}
+
+Point
+BicycleCar::rr() const
+{
+       return Point(this->rrx(), this->rry());
+}
+
+Point
+BicycleCar::rf() const
+{
+       return Point(this->rfx(), this->rfy());
+}
+
+Line
+BicycleCar::left() const
+{
+       return Line(this->lr(), this->lf());
+}
+
+Line
+BicycleCar::rear() const
+{
+       return Line(this->lr(), this->rr());
+}
+
+Line
+BicycleCar::right() const
+{
+       return Line(this->rr(), this->rf());
+}
+
+Line
+BicycleCar::front() const
+{
+       return Line(this->rf(), this->lf());
+}
+
 double
 BicycleCar::ralx() const
 {