]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blobdiff - rrts/incl/rrts.hh
Rename set parent of rrt node method argument
[hubacji1/iamcar2.git] / rrts / incl / rrts.hh
index 8c578b30ae9a58856d69f18491436a68a6997594..9c79420c961cab71a427ec03b56cfafedf78c5b0 100644 (file)
@@ -36,8 +36,9 @@ private:
        double _c = 0.0;
        double _cc = 0.0;
        RRTNode* _p = nullptr;
-       unsigned int _cusp = 0;
+       unsigned int _cusp_cnt = 0;
        int _segment_type = 0;  // 0 ~ straight, 1 ~ left, -1 right
+       bool _p_is_cusp = false;
 public:
        /*! Get cost to parent. */
        double c() const;
@@ -52,13 +53,19 @@ public:
        RRTNode* p() const;
 
        /*! Set parent node. */
+       void p(RRTNode& p, bool can_be_too_close);
        void p(RRTNode& p);
 
-       /*! Get number of backward-forward direction changes. */
-       unsigned int cusp() const;
+       /*! Get number of backward-forward direction changes.
+        *
+        * The parent node may be cusp to this node, i.e. parent may have sp ==
+        * 0 or sgn(sp) differs from sgn(this->sp). In such a situation, the
+        * number of this->cusp_cnt is incremented by one.
+        */
+       unsigned int cusp_cnt() const;
 
        /*! Set number of backward-forward direction changes. */
-       void cusp(RRTNode const& p);
+       void cusp_cnt(RRTNode const& p);
 
        /*! \brief Get Reeds & Shepp segment type.
         *
@@ -72,6 +79,15 @@ public:
        /*! Set Reeds & Shepp segment type. */
        void st(int st);
 
+       /*! Return true if the parent is cusp node and false otherwise. */
+       bool p_is_cusp(void) const;
+
+       /*! Set if the parent node is cusp (direction changed from parent). */
+       void p_is_cusp(bool isit);
+
+       /*! Return true if p would be cusp if set as parent of this. */
+       bool would_be_cusp_if_parent(RRTNode const& p) const;
+
        bool operator==(RRTNode const& n);
 };