return (T(0) < val) - (val < T(0));
}
+class Line;
+
class Point {
private:
double x_ = 0.0;
* \param poly Polygon to consider.
*/
bool inside_of(std::vector<Point> const& poly) const;
+
+ /*! \brief Return `true` if on the right side of the plane.
+ *
+ * The plane is given by the line `li`, where `li->fp()` is the base
+ * point and the direction is given by `li->lp() - li->fp()`.
+ *
+ * \param li The plane to consider is given by `li`.
+ */
+ bool on_right_side_of(Line const& li) const;
+
+ /*! \brief Rotate self around the point.
+
+ \param c Rotation center `Point`.
+ \param angl Angle of rotation.
+ */
+ void rotate(Point const& c, double const angl);
+
+ /*! Return Euclidean distance to `p`. */
+ double edist(Point const& p) const;
+
+ friend std::ostream& operator<<(std::ostream& out, Point const& p);
};
class Line {
*/
bool intersects_with(Point const& c, double const r);
- /*! \brief Return if point `p` is on the right side of the plane.
- *
- * The plane is given by the line `this`, where `this->fp()` is the base
- * point and the direction is given by `this->lp() - this->fp()`.
- *
- * \param p The point to consider.
- */
- bool is_on_right_side(Point const& p) const;
+ double len() const;
+
+ friend std::ostream& operator<<(std::ostream& out, Line const& li);
};
/*! Store coordinates `x`, `y`, and heading `h`. */
-class Pose : public Point {
+class Pose : public virtual Point {
private:
double h_ = 0.0;
public:
/*! Set pose (`x`, `y`, and `h`.) */
void set_pose(Pose const& p);
- /*! \brief Rotate self around the point.
-
- \param c Rotation center `Point`.
- \param angl Angle of rotation.
- */
void rotate(Point const& c, double const angl);
friend std::ostream& operator<<(std::ostream& out, Pose const& p);
};
-class PoseRange : public Pose {
+class PoseRange : public virtual Pose {
private:
double e_ = 0.0;
using Pose::h;
*
* - `x()` and `y()` methods returns coordinates of rear axle center.
*/
-class BicycleCar : public Pose, public CarSize, public CarMove {
+class BicycleCar : public virtual Pose, public virtual CarSize,
+ public virtual CarMove {
private:
public:
/*! \brief Return `false` if `bc` is not achievable.
/*! Get frame's right front y coordinate. */
double rfy() const;
+ /*! Get frame's left front point. */
+ Point lf() const;
+
+ /*! Get frame's left rear point. */
+ Point lr() const;
+
+ /*! Get frame's right rear point. */
+ Point rr() const;
+
+ /*! Get frame's right front point. */
+ Point rf() const;
+
+ /*! Get frame's left side. */
+ Line left() const;
+
+ /*! Get frame's rear side. */
+ Line rear() const;
+
+ /*! Get frame's right side. */
+ Line right() const;
+
+ /*! Get frame's front side. */
+ Line front() const;
+
/*! Get rear axle's left x coordinate. */
double ralx() const;