From: johanengelen Date: Mon, 14 Jul 2008 21:11:34 +0000 (+0000) Subject: improve get_nodetype angle checking, thanks nathan! X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c9f915e868671083c5d1b4be36ec781e6efa63b7;p=inkscape.git improve get_nodetype angle checking, thanks nathan! --- diff --git a/src/helper/geom-nodetype.cpp b/src/helper/geom-nodetype.cpp index fa01a0bcb..1983fd42c 100644 --- a/src/helper/geom-nodetype.cpp +++ b/src/helper/geom-nodetype.cpp @@ -59,17 +59,15 @@ NodeType get_nodetype(Curve const &c_incoming, Curve const &c_outgoing) return NODE_SMOOTH; } - double const angle1 = Geom::atan2(-deriv1[n1]); - double const angle2 = Geom::atan2(deriv2[n2]); - - if ( !are_near(angle1, angle2) ) - return NODE_CUSP; // derivatives are not colinear + if ( are_near( Geom::cross(deriv1[n1], deriv2[n2]), 0) && (Geom::dot(-deriv1[n1], deriv2[n2]) > 0) ) { + // Apparently, the derivatives are colinear and in same direction but does the order of the derivatives match? + if (n1 != n2) + return NODE_SMOOTH; + else + return NODE_SYMM; + } - // Apparently, the derivatives are colinear but does the order of the derivatives match? - if (n1 != n2) - return NODE_SMOOTH; - else - return NODE_SYMM; + return NODE_CUSP; } }