summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b17d5a7)
raw | patch | inline | side by side (parent: b17d5a7)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 13 Sep 2008 21:18:32 +0000 (21:18 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 13 Sep 2008 21:18:32 +0000 (21:18 +0000) |
src/display/curve.cpp | patch | blob | history | |
src/nodepath.cpp | patch | blob | history |
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 0b560883bd367b2df6de89107e12821469e87fcd..52ffe4f5b9a4b73acc2dc034ec260e5f179e5c66 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
/**
* returns the number of nodes in a path, used for statusbar text when selecting an spcurve.
+ * Sum of nodes in all the paths. When a path is closed, and its closing line segment is of zero-length,
+ * this function will not count the closing knot double (so basically ignores the closing line segment when it has zero length)
*/
guint
SPCurve::nodes_in_path() const
nr += (*it).size();
nr++; // count last node (this works also for closed paths because although they don't have a 'last node', they do have an extra segment
+
+ if (it->closed()) {
+ Geom::Curve const &c = it->back_closed();
+ if (are_near(c.initialPoint(), c.finalPoint())) {
+ nr--; // do not count closing knot double for zero-length closing line segments
+ }
+ }
}
return nr;
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 49bf78585b698819e5c944c4a388152f20ffc060..8e54bf89cf127064d3f21393899a2d6292a5a2d5 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -564,7 +564,7 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec
/* Remember that last closing segment is always a lineto, but its length can be zero if the path is visually closed already
* If the length is zero, don't add it to the nodepath. */
Geom::Curve const &closing_seg = pit->back_closed();
-// if ( ! closing_seg.isDegenerate() ) {
+ // Don't use !closing_seg.isDegenerate() as it is too precise, and does not account for floating point rounding probs (LP bug #257289)
if ( ! are_near(closing_seg.initialPoint(), closing_seg.finalPoint()) ) {
NR::Point pos = closing_seg.finalPoint() * (Geom::Matrix)np->i2d;
sp_nodepath_node_new(sp, NULL, t[i++], NR_LINETO, &pos, &pos, &pos);