Where `sp` is speed and `st` is steering of the car.
*/
void next();
+ /*! \brief Rotate self around the point.
+
+ \param cx Horizontal coordinate of rotation center.
+ \param cy Vertical coordinate of rotation center.
+ \param angl Angle of rotation.
+ */
+ void rotate(double cx, double cy, double angl);
// getters, setters
double x() const { return this->x_; }
this->y(this->y() + this->sp() * sin(this->h()));
}
+void BicycleCar::rotate(double cx, double cy, double angl)
+{
+}
+
BicycleCar::BicycleCar()
{
}
bc.st(-M_PI);
bc.next();
WVPASSEQ_DOUBLE(-0.2, bc.st(), 0.00001);
+
+ // rotate
+ bc.x(-1);
+ bc.y(1);
+ bc.h(0);
+ bc.rotate(-1, 1, M_PI);
+ WVPASSEQ_DOUBLE(-1, bc.x(), 0.00001);
+ WVPASSEQ_DOUBLE(1, bc.y(), 0.00001);
+ WVPASSEQ_DOUBLE(M_PI, bc.h(), 0.00001);
+ bc.rotate(0, 1, -M_PI / 2);
+ WVPASSEQ_DOUBLE(0, bc.x(), 0.00001);
+ WVPASSEQ_DOUBLE(2, bc.y(), 0.00001);
+ WVPASSEQ_DOUBLE(M_PI / 2, bc.h(), 0.00001);
}
WVTEST_MAIN("test collide functions")