summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f23d684)
raw | patch | inline | side by side (parent: f23d684)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Mon, 14 Jul 2008 20:42:24 +0000 (20:42 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Mon, 14 Jul 2008 20:42:24 +0000 (20:42 +0000) |
src/helper/geom-nodetype.cpp | patch | blob | history |
index b43c30a8f848eaa61f062f86fc1ec4b49ca24533..fa01a0bcb19ac4d85d0bacdaecded5e58e30cf24 100644 (file)
* 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!
*/
// 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]);