How to avoid distortions with Stroke to Path?

Post questions on how to use or achieve an effect in Inkscape.
theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 5:16 pm

When changing a stroke to path you get unwanted distortions. I wouldn't call them minor.
1. Why?
2. How to avoid them? Is there a preference setting which I haven't found yet?

Example:
To duplicated paths on top of each other. Black bottom, red top.
After "stroke to path" of the top red path you can see the unexpected and unwanted distortions.

StrokeToPathDistortion.gif
StrokeToPathDistortion.gif (98.41 KiB) Viewed 4385 times
Win7/64, Inkscape 0.92.2

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to avoid distortions with Stroke to Path?

Postby Lazur » Wed Oct 11, 2017 6:07 pm

My guess is you have some path effects on the original objects.
If you convert those to paths before (Ctrl+Shift+C) the stroke to path (Ctrl+Alt+C), it "should" look as expected. (Although end caps and miters can end up with errors unrelated to that example.)

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 6:37 pm

Lazur wrote:My guess is you have some path effects on the original objects.
Not that I know of. I haven't used any LPE. These are just some Bézier curves. There is nothing to convert with Shift+Ctrl+C.
The status bar tells me: Path 8 nodes on layer Layer1

Well, if I break this path (Shift+Ctrl+K) into its 4 subpaths and do "Stroke to Path" for each subpath individually, I do not see distortions.
Does this mean, if I have a path consisting of 50 or more subpaths I have to break it and do it individually 50 times to avoid distortions? Are you serious?

StrokeToPathDistortion3.png
StrokeToPathDistortion3.png (61.6 KiB) Viewed 4357 times
Last edited by theozh on Wed Oct 11, 2017 6:58 pm, edited 1 time in total.
Win7/64, Inkscape 0.92.2

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to avoid distortions with Stroke to Path?

Postby Lazur » Wed Oct 11, 2017 6:40 pm

Hmm weird.
Does it work right after breaking apart -when all subpaths are still selected? If so there would be no need for going over them one by one.

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 6:46 pm

OK. Yes...
The intuitive, direct way doesn't seem to work without distortions:
1. select combined path
2. Stroke to Path
You get distortions.

Workaround without distortions:
1. select combined path
2. break appart (fortunately, all the subpaths stay selected)
3. Stroke to Path (fortunately, all the subpaths stay selected)
4. Union
No obvious distortions.

It's not clear to my why the first version shouldn't work properly...
Not obvious to me... worth a bug report?!
Win7/64, Inkscape 0.92.2

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to avoid distortions with Stroke to Path?

Postby Lazur » Wed Oct 11, 2017 7:01 pm

Yes, probably worth a bug report -if regression wasn't reported already.

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 7:16 pm

Actually, my curves were B-Splines....
Well, for this, there is already a bug report.
https://bugs.launchpad.net/inkscape/+bug/1502587
Although, with single paths it seems to work for me but not with combined paths.
Win7/64, Inkscape 0.92.2

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 9:21 pm

well, also with (now really) Bézier curves I observe distortions. Blue=original path, Red=Stroke to Path.
This time, the "Stroke to Path" gets even thicker at some place...

StrokeToPathDistortion4.png
StrokeToPathDistortion4.png (26.31 KiB) Viewed 4313 times
Win7/64, Inkscape 0.92.2

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to avoid distortions with Stroke to Path?

Postby Moini » Wed Oct 11, 2017 10:03 pm

As they are just around the crossings, I'd guess these are numeric imprecisions. Do they get smaller when you enlarge the paths first or when you set the precision value to a higher precision?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 11:02 pm

I have set the precision to the maximum (Numeric precision 16 digits and Minimum exponent -10). But I'm not sure whether this at all influences the calculation precision of Inkscape or just determines the SVG number output.
Well, if I enlarge the path e.g. by 500% and do the "Stroke to Path" it seems to look better.
However, if I shrink the new path again to 20% the resulting path is thinner than the original and expected path. So, it's not really a feasible workaround to scale up, do "Stroke to Path" and scale down again...
I always thought the advantage of vector graphics is that you can easily scale things and it always stays the same quality. Have I misunderstood this?... :?
Win7/64, Inkscape 0.92.2

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Wed Oct 11, 2017 11:37 pm

Actually, it's difficult for me to believe that this should be numeric imprecision.
A concrete example:
One node of a crossing which should be at coordinates x=73.12, y=264.17 is actually located at x=73.023, y=264.348 (that's about 0.1% off. Well, a detail, who cares ;-)).
If Inkscape really calculates with 8 or 16 digits why or how should it result in such a "large" error?
And the second workaround above shows that Inkscape CAN do better. So, my tentative guess is that there is something wrong with the algorithm to find the intersection on a combined path and create the proper new path.
Win7/64, Inkscape 0.92.2

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to avoid distortions with Stroke to Path?

Postby Moini » Thu Oct 12, 2017 6:30 am

Grouping after stroke to path and before shrinking could work - it only applies transforms, then...
Inkscape is performing several unit conversions in the background, and those add up (or rather, multiply). Could be an explanation.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Polygon
Posts: 393
Joined: Thu Dec 19, 2013 3:27 am

Re: How to avoid distortions with Stroke to Path?

Postby Polygon » Fri Oct 13, 2017 3:56 am

theozh wrote:
Lazur wrote:My guess is you have some path effects on the original objects.
Not that I know of. I haven't used any LPE. These are just some Bézier curves. There is nothing to convert with Shift+Ctrl+C.
The status bar tells me: Path 8 nodes on layer Layer1

Well, if I break this path (Shift+Ctrl+K) into its 4 subpaths and do "Stroke to Path" for each subpath individually, I do not see distortions.
Does this mean, if I have a path consisting of 50 or more subpaths I have to break it and do it individually 50 times to avoid distortions? Are you serious?

StrokeToPathDistortion3.png

Can´t you just upload such a problematic Inkscape file - so we can check what our version will do with it?
I never experienced this kind of issue.

Cheers
P

theozh
Posts: 437
Joined: Fri Mar 23, 2012 6:30 pm

Re: How to avoid distortions with Stroke to Path?

Postby theozh » Fri Oct 13, 2017 4:14 am

@Polygon, find attached a sample... I'm curious how this behaves on your versions...
Attachments
StrokeToPathDistortion.svg
(43.46 KiB) Downloaded 183 times
Win7/64, Inkscape 0.92.2

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: How to avoid distortions with Stroke to Path?

Postby tylerdurden » Fri Oct 13, 2017 4:44 am

Like the text/outset issue, this may something to do with the proximity of nodes and handles? It is reduced somewhat by using the document 1:1 scale (px/uu) but exists nonetheless.

Reproduced in winxp-32, inkscape Inkscape 0.91 r13725.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Polygon
Posts: 393
Joined: Thu Dec 19, 2013 3:27 am

Re: How to avoid distortions with Stroke to Path?

Postby Polygon » Fri Oct 13, 2017 7:24 pm

I think I found something and scale plays a role.
The smaller the stroke the worser it gets:
Image

Cheers
P.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to avoid distortions with Stroke to Path?

Postby brynn » Fri Oct 13, 2017 9:09 pm

I don't have as severe distortions as you have produced, but I do some distortions when there should be none.

Should definitely be reported as a bug, if it hasn't been already.

Inkscape 0.92.2, 64-bit, 7z pkg, Windows 7 Pro, 64-bit

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: How to avoid distortions with Stroke to Path?

Postby tylerdurden » Fri Oct 13, 2017 9:13 pm

Not sure it's really a bug... but an artifact related to proximity of bezier nodes.

Image
Last edited by tylerdurden on Fri Oct 13, 2017 9:51 pm, edited 1 time in total.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: How to avoid distortions with Stroke to Path?

Postby tylerdurden » Fri Oct 13, 2017 9:27 pm

Tested theory on file from topic linked above:

Image

Seems node proximity is relevant to both issues.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to avoid distortions with Stroke to Path?

Postby brynn » Mon Oct 16, 2017 6:28 pm

Isn't proximity of other nodes to be expected? How could you avoid it in the original use case here?

Edit
Well, proximity of which nodes? In the original use case, the 4 nodes at the intersection can't be avoided. But maybe you're thinking of other nodes?

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: How to avoid distortions with Stroke to Path?

Postby tylerdurden » Wed Oct 18, 2017 12:31 am

The separate paths convert stroke no problem. So the compound path nodes must interact in stroke conversion.

The more nodes, or at least more nodes in the compound path near the intersections, the more accurate the conversion likely will be.
Image
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to avoid distortions with Stroke to Path?

Postby brynn » Wed Oct 18, 2017 4:51 am

Oh ok. So you're thinking, the more nodes, the more calculations, the more rounding errors? Or if not rounding, then some other errors.

Thanks for explaining.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to avoid distortions with Stroke to Path?

Postby Moini » Wed Oct 18, 2017 7:10 am

I guess it's the same numeric issue as often happens with union - it must be doing a union internally.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”