]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/commitdiff
Fix computation of cusp cnt
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 16 Mar 2023 15:29:12 +0000 (16:29 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 16 Mar 2023 15:29:12 +0000 (16:29 +0100)
rrts/incl/rrts.hh
rrts/src/rrts.cc

index dc146c488bd0b8cc731f9fd7f3a8f7044b7bfe63..8503e0c79ea0e61ee2e1e6bd5538f5990d602352 100644 (file)
@@ -55,7 +55,12 @@ public:
        /*! Set parent node. */
        void p(RRTNode& p);
 
-       /*! Get number of backward-forward direction changes. */
+       /*! 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. */
index ae27cfa49aeb4cf8e24da544651fe8c2617239c9..3d84e6225c0d10ed6ccf99da5ef512be8f122a3b 100644 (file)
@@ -72,7 +72,7 @@ void
 RRTNode::cusp_cnt(RRTNode const& p)
 {
        this->_cusp_cnt = p.cusp_cnt();
-       if (this->sp() != p.sp() || this->sp() == 0.0) {
+       if (this->_p_is_cusp) {
                this->_cusp_cnt++;
        }
 }