/*! 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. */
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++;
}
}