]> rtime.felk.cvut.cz Git - hubacji1/psp.git/blobdiff - api/psp.h
Rename `possible_inits` to `possible_goals`
[hubacji1/psp.git] / api / psp.h
index c79cfbadfe4f131322ece8fdcab7298a5773b865..91e0b9c07a35e3fe3ce638f71832298c45fdbbbd 100644 (file)
--- a/api/psp.h
+++ b/api/psp.h
@@ -2,6 +2,7 @@
 #define PSP_H
 
 #include <tuple>
+#include <vector>
 
 #include "bcar.h"
 #include "pslot.h"
@@ -18,11 +19,14 @@ class PSPlanner {
                 BicycleCar gc_;
                 ParkingSlot ps_;
 
-                // find entry to slot by reverse approach
+                // find entry to slot
                 void fe_parallel();
                 void fe_perpendicular();
+                // find entry to slot by reverse approach
                 void fer_parallel();
                 void fer_perpendicular();
+                // set goal car
+                void gc_to_4();
         public:
                 /*! \brief Return `true` if there is collision.
 
@@ -42,6 +46,11 @@ class PSPlanner {
                 slot is forward.
                 */
                 bool forward();
+                /*! \brief Guess goal car
+
+                Set the goal car guessed from the parking slot.
+                */
+                void guess_gc();
                 /*! \brief Has current car `cc` left?
 
                 Return `true` if the current car `cc` left the parking
@@ -54,6 +63,22 @@ class PSPlanner {
                 parking slot `ps`.
                 */
                 bool parked();
+                /*! \brief Return possible starts of parking maneuver
+
+                When any `BicycleCar` of possible inits is reached, then
+                parking maneuver is a peace of cake.
+
+                \param cnt Number of inits.
+                \param dist Distance between inits.
+                */
+                std::vector<BicycleCar> possible_goals(
+                        unsigned int cnt,
+                        double dist
+                );
+                std::vector<BicycleCar> possible_goals()
+                {
+                        return this->possible_goals(10, 1);
+                }
 
                 // find entry
                 /*! \brief Find entry to the parking slot.
@@ -73,29 +98,4 @@ class PSPlanner {
                 PSPlanner();
 };
 
-/*! \brief Return intersection of two line segments.
-
-The output is tuple `std::tuple<bool, double, double>`, where the first
-value is true when there is an intersection and false otherwise. The
-second and third parameters in the return tuple are coordinates of the
-intersection.
-
-\see https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
-
-\param x1 First line segment first `x` coordinate.
-\param y1 First line segment first `y` coordinate.
-\param x2 First line segment second `x` coordinate.
-\param y2 First line segment second `y` coordinate.
-\param x3 Second line segment first `x` coordinate.
-\param y3 Second line segment first `y` coordinate.
-\param x4 Second line segment second `x` coordinate.
-\param y4 Second line segment second `y` coordinate.
-*/
-std::tuple<bool, double, double> intersect(
-        double x1, double y1,
-        double x2, double y2,
-        double x3, double y3,
-        double x4, double y4
-);
-
 #endif /* PSP_H */