Simplify path?

Bug #668341 reported by LucaDC on 2010-10-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Unassigned

Bug Description

Try this: it's fun if it happens to work for you!
1. open a new fresh document,
2. draw a circle with the circle tool (ctrl-draw at ~45°);
3. press and keep hold ctrl-L (simplify path);
4. watch the movie!
If you don't get any funny movie, it means you have been unluky: try again :)
Or you can try the attachment: select any of the shapes and super-ctrl-L here and there.

Jokes apart, I don't always get the same result: it depends on what I've done before and on something else I can't figure out. Sometimes after the first single ctrl-L you get a slightly deformed circle, some others you get a drop (one node becomes a <90° cusp). I really can't reproduce this: I've tried saving one document to see if it's document related but I don't think so as I always start from the same template but don't always get this effect. Also sometimes it wasn't happening, then it happens and after it stops; all in the same session. Maybe it be zoom related?

About circles: if you draw a circle and press ctrl-L, you get 5 non equi-spaced cusp nodes with handlers almost aligned (they may be not for more complex starting paths); then if you press ctrl-L again you get 4 out of 5 nodes slightly moving. Sometimes (as I was describing at the beginning) they do not move _slightly_ but so much that the circle is heavily deformed until it becomes a drop, smaller at the beginning and finally exploding to a huge one.
Taking apart the final special-effect, i find that the shape becomes much more complex after the simplification! Compare it to the result of the "Object to path" conversion.
And also, the simplification process should converge to a shape that is a simplification of the starting path without distorting it more than a small tolerance: if we want to be more general and accept a drastic simplification, any starting path should at least converge to the most simplicistic shape that preserves its characteristic topology, that is I expect an '8' shape to converge to a "perfect 8" shape (i.e. with the minimum number of nodes required to have an 8 shape) or, being even more drastic, at least to a circle. That said, I definitely expext a circle to converge to a circle!

All this considerations can be applied to any starting path, but defining if the approximation is good or not is difficoult. For a circle it's much more evident as the starting shape is perfectly simmetrical.

Also, I've noticed that in general if you ctrl-L a single path you get result A1, if you ctrl-L another you get result A2 and if you select both and ctrl-L them, you don't get A1 on the first and A2 on the second but something different for both. in my opinion this is not acceptable as I expect the operation to be applied on each selected object as if it was alone.

Thanks for the attention.
Regards.

LucaDC (dicappello) wrote :
Alvin Penner (apenner) wrote :

confirmed on Windows XP, Inkscape 0.48.
It does not always happen, but if it does happen, then repeated application of ctrl-L will eventually shrink the object down to a very small vanishing point.

Changed in inkscape:
status: New → Confirmed
~suv (suv-lp) wrote :

> Changed in inkscape:
> status: New → Confirmed

Not a bug IMHO but a feature request: you are asking for a new implementation of the Simplify command that would be useful for technical drawing. The current implementation of the command however is not deterministic and designed to be used in artistic drawings:

Quoting 'The Book of Inkscape' [1]:
«12.3 Simplifying

A very important operation on paths is simplifying. When you simplify a path (Path > Simplify or Ctrl-L), Inkscape attempts to redraw that path using fewer nodes, ironing out smaller details but preserving the large-scale features and the overall shape. If this description sound a bit vague, it's because the operation itself is not entirely deterministic; usually, it is difficult to accurately predict the result of simplifying before you actually try it. Even the reduction of the number of nodes is not guaranteed, although common.

Despite that, it is a very common operation and a true lifesaver for certain styles of artistic drawing. In technical drawing, on the other hand, it is rarely useful, if only because it considers any sharp corners in a path to "defects" that should be smoothed out.

One effect that you can always count on is that if your path has nodes that can be deleted without any change in the shape of the path, they will get deleted by simplifying. This includes any nodes you have added with the Node tool or by the Add Nodes extension but never moved from their initial positions.»

[1] <http://nostarch.com/inkscape.htm>

> in my opinion this is not acceptable as I expect
> the operation to be applied on each selected object
> as if it was alone.

It is intended to work that way:
«The amount of simplification (called the threshold) depends on the size of the selection. Therefore, if you select a path along with some larger object, it will be simplified more aggressively than if you select that path alone.»
<http://inkscape.org/doc/advanced/tutorial-advanced.html>

~suv (suv-lp) wrote :

related earlier reports:

Bug #170152 “Simplify Path options/smooth tool”
Bug #170637 “Settings window for simplify path tool”
Bug #170441 “Simplify selected nodes”
Bug #257771 “Don't convert smooth nodes to cusp nodes”

~suv (suv-lp) wrote :

>> in my opinion this is not acceptable as I expect
>> the operation to be applied on each selected object
>> as if it was alone.

It seems there are hidden options for the Simplify command. One of them allows to change the behavior when the selection contains multiple objects: '0' is default and takes the size of the selection into account, '1' applies the simplify command to each individual object in the selection.

Edit 'preferences.xml', add the following group within the group with the id "option" and test ;)

   <group
       id="simplifyindividualpaths"
       value="1" />

~suv (suv-lp) wrote :

Still trying to figure out what the other option does I discovered in the sources:

    <group
       value="0"
       id="simplifyJustCoalesce" />

Maybe you are faster in figuring out how it influences the behavior or the Simplify command? :)

~suv (suv-lp) wrote :

From the release notes 0.45:

«Simplify Path now has two modes when working with a group of paths: the default mode, which treats all of the paths as one large object to simplify, or the new mode, which acts the same as using Simplify on each path in a group separately. In preferences.xml, set options.simplifyindividualpaths to 1 to get the new mode. »

<http://wiki.inkscape.org/wiki/index.php/ReleaseNotes045#Even_more_improvements>

LucaDC (dicappello) wrote :

>Alvin Penner wrote on 2010-10-30:
>It does not always happen, but if it does happen, then repeated application of ctrl-L will eventually shrink the object down >to a very small vanishing point.

No, it initially shrinks to a small object but after a while explodes. It's not a convergent transformation. I think it could be related to successive approximations of handlers.

LucaDC (dicappello) wrote :

>~suv wrote on 2010-11-01:
>Not a bug IMHO but a feature request: you are asking for a new implementation of the Simplify command that would
> be seful for technical drawing.
No, forget technical drawing: you don't approximate a shape in technical drawing, you simply draw as it has to be. :)
I'm not asking for a new feature but for the feature you described to be implemented as it should.

>Quoting 'The Book of Inkscape' [1]:
>«12.3 Simplifying
>A very important operation on paths is simplifying. When you simplify a path (Path > Simplify or Ctrl-L), Inkscape attempts
>to redraw that path using fewer nodes, ironing out smaller details but preserving the large-scale features and the overall
>shape.
That's what I said: "preserving large-scale features and the overall shape". What is the overall shape of a circle? Is the fact that a circle is a smooth curve a "large-scale feature" or not? So, why converting smooth points to cusps?

> In technical drawing, on the other hand, it is rarely useful, if only because it considers any sharp corners in a path
> to "defects" that should be smoothed out.
Well, now the opposite is happening...

> One effect that you can always count on is that if your path has nodes that can be deleted without any change in the
> shape of the path, they will get deleted by simplifying.
And what about the four-nodes circle becoming a five-nodes apple?

> «The amount of simplification (called the threshold) depends on the size of the selection. Therefore, if you select a path
> along with some larger object, it will be simplified more aggressively than if you select that path alone.»
Ok, if this is how it was intented that's fine for me too. Just finding it's not obvious for who doesn't read the "doc/advanced/tutorial-advanced.html" guide to look for the "simplification" tool... ;)

LucaDC (dicappello) wrote :

About the hidden options, thanks for pointing them out. Sorry but I don't think I'll have time to play with them in the near future. Now that I know that different selections give different results, I'll just be more careful on what to apply the simplification: it's easier to me than manually modifying the preferences file.
In any case, should I need them I'll know where to look for. Better if they were in the preferences dialog too, at least one would learn there can be such difference in behaviour.
Thanks.

~suv (suv-lp) wrote :

> 3. press and keep hold ctrl-L (simplify path);
> 4. watch the movie!

You are aware that the Simplify command is accelerated and increasingly aggressive if used like this (press and hold)?

«Accelerated Simplify: similar to scrolling, a single Simplify (Ctrl+L) does a slight simplification, but invoking it several times in quick succession makes it act more and more aggressively on the selected objects. It is thus easy to apply the exact amount of simplification you need for each case.»
<http://wiki.inkscape.org/wiki/index.php/ReleaseNotes038#Interface_and_usability>

«Simplify path: This command reduces the number of nodes in a path while keeping the shape of the path almost the same. The larger the selection, the more aggressive the simplification. The command may be repeated. If repeated within a set time period (0.5 seconds), the simplification also becomes more aggressive. (…)»
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-Editing.html#Paths-Misc>

Also, there is a GUI preferences setting that allows to change the threshold for the Simplify command:

«As a new feature, the Simplify threshold can now be set with more precision. »
<http://wiki.inkscape.org/wiki/index.php/ReleaseNotes044#Inkscape_Preferences_dialog>

«(…) The Simplification threshold can be changed under the Misc tab in the Inkscape Preferences dialog (File → icon Inkscape Preferences... (Shift+Ctrl+P)).»
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-Editing.html#Paths-Misc>

LucaDC (dicappello) wrote :

Yes, I am. But this is not related to the distortion and unconvergence of the result.
Aggressive does not mean distructive!
So I still think that a circle should be kept a circle with 4 symmetrical smoth nodes.
Also, the unitless parameter you are talking about is obscure enough to be not so much useful to me.

~suv (suv-lp) wrote :

> I still think that a circle should be kept a circle with 4 symmetrical smoth nodes.

<http://article.gmane.org/gmane.comp.graphics.inkscape.devel:2180>
<http://article.gmane.org/gmane.comp.graphics.inkscape.devel:2181>

(Attaching the discussion (or what has been archived) about the new 'Simplify' feature on the mailing list 'inkscape-devel'. Maybe useful if someone wants to dive into the code and redesign or "fix" the command).

~suv (suv-lp) wrote :

>>> I don't always get the same result: it depends on
>>> what I've done before and on something else I
>>> can't figure out.

>> It does not always happen, but if it does happen, then
>> repeated application

> Still trying to figure out what the other option does

Finally, yes, I do see the same (that's why trying to figure out the option 'simplifyJustCoalesce' failed or was utterly inconclusive). As far as I can tell the change in behavior of the accelerated simplify command does not depend on what I have done before in the current document or Inkscape instance, and is not consistently influenced or reset by relaunching inkscape (with or without resetting the preferences).

Raising importance to 'Medium' (and offering my apologies to LucaDC ;) )

Changed in inkscape:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers