diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-07-14 20:42:24 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-07-14 20:42:24 +0000 |
| commit | 9d4e78f133934d2a598693c6b31d5b7a14ffe050 (patch) | |
| tree | 309c05e21f89e98bd737a5b8ec06969b2eaa0397 /src | |
| parent | noop: add comment about multiple consecutive movetos (diff) | |
| download | inkscape-9d4e78f133934d2a598693c6b31d5b7a14ffe050.tar.gz inkscape-9d4e78f133934d2a598693c6b31d5b7a14ffe050.zip | |
add comment and implementation of get_nodetype where both curves are zero_length or only one of them.
(bzr r6306)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-nodetype.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/helper/geom-nodetype.cpp b/src/helper/geom-nodetype.cpp index b43c30a8f..fa01a0bcb 100644 --- a/src/helper/geom-nodetype.cpp +++ b/src/helper/geom-nodetype.cpp @@ -23,6 +23,10 @@ namespace Geom { * Returns the nodetype between c_incoming and c_outgoing. Location of the node is * at c_incoming.pointAt(1) == c_outgoing.pointAt(0). If these two are unequal, * the returned type is NODE_NONE. + * If one of the curves has zero length, but the other doesn't, then the returned type + * is NODE_SMOOTH. If both have zero length, the returned type is NODE_SYMM. There is no + * good reason for this. Feel free to change, but check all uses of this method such + * that it doesn't break anything! * This method uses exact floating point comparison, so the final and initial points of * the two input curves should match exactly! */ @@ -39,14 +43,22 @@ NodeType get_nodetype(Curve const &c_incoming, Curve const &c_outgoing) // Determine lowest derivative that is non-zero int n1 = 1; - while ( (deriv1[n1] == Point(0,0)) && (n1 < 3) ) { + while ( (deriv1[n1] == Point(0,0)) && (n1 <= 3) ) { n1++; } int n2 = 1; - while ( (deriv2[n2] == Point(0,0)) && (n2 < 3) ) { + while ( (deriv2[n2] == Point(0,0)) && (n2 <= 3) ) { n2++; } + // if one of the paths still has zero derivative + if ( (n1 > 3) || (n2 > 3) ) { + if (n1 == n2) + return NODE_SYMM; + else + return NODE_SMOOTH; + } + double const angle1 = Geom::atan2(-deriv1[n1]); double const angle2 = Geom::atan2(deriv2[n2]); |
