(Sending yet again because there might be something wrong with the SMTP server I was using and I don't see the message appearing on the list...)
Krzysztof Kosiński wrote:
W dniu 10 lutego 2010 19:14 użytkownik Jasper van de Gronde <th.v.d.gronde@...528...> napisał:
If you're talking about having a closed path and then not adding the closing segment, please reconsider. Inkscape used to do this in the past and it caused some very nasty bugs (having to do with round-tripping for one), apart from simply being incorrect (at least in SVG).
Some background: currently paths always store a "closing segment" that is not part of the "normal" user supplied path data, but can be iterated over using end_closed. The intent is to have a well defined way to stroke and fill a path. This segment is stored even if it is degenerate (zero length), for example when the path is closed and has only Bezier curves.
So the closing segment is also present if that path is not actually closed? Possibly this is a case of a way too overloaded term :) In any case, I'm talking about the following paths all being definitely different (and Inkscape should at least be able to round-trip their structure, even after transformations):
M 0,0 L 1,1 M 0,0 L 1,1 z M 0,0 L 1,1 L 0,0 z M 0,0 L 1,1 L 0,0
... This will simplify the code in the node tool, because the path won't have a zero-length segment at the end that has to be intelligently skipped. By itself it probably won't fix the bug I mentioned, but it will simplify a quirk when dealing with closed paths.
Why would it simplify this? If it is present without the path being closed this makes sense (you'd indeed have to skip it), but for closed paths the segment is definitely there (even if zero length). Remember that in general a zero-length segment is simply valid SVG and the close-path command is defined as drawing a straight segment between the current point and the beginning of the subpath (whether this segment is zero-length or not).
Alternatively, the iterators might be modified so that iterating over the closed path doesn't return the extra zero-length segment, but then I see no need to store it in the first place. If there is some specific need to have this zero-length segment in the path, I will reconsider this.
See the above, specifically you may want to have a very, very close look at all the details of marker and stroke rendering, as well as the path implementation notes: http://www.w3.org/TR/SVG11/implnote.html#PathElementImplementationNotes
It is possible that what you're trying to do is okay, but you need to be VERY careful here.
Jasper: I see that you've wrote the PathString class that writes SVG path strings in Inkscape (in svg/path-string.cpp). Can you modify it so that if the last segment of a path is not linear, it is always written in absolute coordinates regardless of the preference settings? Otherwise we sometimes suffer from a loss of precision when writing the transformed path, which (I believe) causes the "rotate adds node" bug.
This sounds suspect. No loss of precision should ever add (or remove) a node. If it does there is something wrong (the number of nodes is completely unrelated to the position of the nodes).
Obviously any loss of precision with relative coordinates is an issue itself (and I'll try to have a look over the weekend), but it should (as in: if it isn't Inkscape has a more serious bug) be completely separate from any problems with node duplication.