diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-07-14 21:11:34 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-07-14 21:11:34 +0000 |
| commit | c3e7e3fca76f24d5da1c39ec50158833ec6ad280 (patch) | |
| tree | 80f52b20a15aee1b44d62d05d334c059e0fff138 /src | |
| parent | add comment and implementation of get_nodetype where both curves are zero_len... (diff) | |
| download | inkscape-c3e7e3fca76f24d5da1c39ec50158833ec6ad280.tar.gz inkscape-c3e7e3fca76f24d5da1c39ec50158833ec6ad280.zip | |
improve get_nodetype angle checking, thanks nathan!
(bzr r6307)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-nodetype.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
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; } } |
