Linewidth of scaled polygons

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

Linewidth of scaled polygons

Postby theozh » Wed Apr 11, 2018 4:52 am

If I scale a polygon in one direction, e.g. a triangle, I would expect the result shown on the left.
(back=original, red=scaled) However, Inkscape creates the result in the middle.
As you can see in the sketch on the right, apparently the thickness of the scaled line depends on the angle of the line.
The option "When scaling object, scale stroke width by the same proportion" is switched off.
Bug or feature? Any ideas to avoid this?

ScaledPolygon.png
ScaledPolygon.png (26.44 KiB) Viewed 1472 times
Win7/64, Inkscape 0.92.2

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

Re: Linewidth of scaled polygons

Postby brynn » Wed Apr 11, 2018 5:07 am

There is a similar problem discussed in this topic: viewtopic.php?f=5&t=33496

I'm not sure if any of those circumstances apply to you. For example, that user was using version 0.48, and you're using 0.92.2. It sounds like their objects are in groups.... Well, I'm not sure if yours are in a group, since we don't have the SVG file.

I would try checking on Inkscape Preferences > Input/Output > SVG Output > Path Data. If it's not set for Optimized, then try setting it thus.

If that doesn't help, please share an SVG file with us, which is showing the problem. Then we can investigate with first hand info.

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

Re: Linewidth of scaled polygons

Postby brynn » Wed Apr 11, 2018 5:13 am

And here's another similar topic: viewtopic.php?f=5&t=33071

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

Re: Linewidth of scaled polygons

Postby theozh » Wed Apr 11, 2018 5:26 am

Thanks, @brynn, for the links. They didn't show up during my search.
It somehow seems related. And as I see so far, no simple fix...
Attached the simple example from above as SVG... the left shapes was created by converting the triangle to path first, but then I loose the properties and features of the triangle. This strange scaling also appears with a tetragon (from the polygon-tool) but not with a rectangle (from the rectange-tool).
Attachments
ScaledPolygon.svg
(7.54 KiB) Downloaded 162 times
Win7/64, Inkscape 0.92.2

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

Re: Linewidth of scaled polygons

Postby Moini » Wed Apr 11, 2018 5:44 am

Convert it to a path, to remove the transform. The transform, by definition, transforms the whole object, including its stroke.
As far as I know, this is just how things work. You cannot have both for polygons that are symmetrical by default.

For rectangles, Inkscape provides a way to move the info from the transform matrix that applies to the whole object into the rectangle width/height values, for convenience, when resizing. Same for ellipses. This calculation is just not possible for stars/polygons. Maybe if you used a path effect to create the star, then it would work.
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: Linewidth of scaled polygons

Postby theozh » Fri Apr 13, 2018 4:45 am

@Moini, ok, that's how it is. However, I don't understand the logic behind.
A stroke is a stroke and can be scaled or not. If I don't want it to be scaled I deselect the option "scaling stroke proportionally". Polygons and stars also have a fill and a stroke. Why shouldn't it be possible to give a certain stroke width after scaling? Well, it's just not implemented.
If I convert the polygon into a path I am loosing the features of the polygon. Too bad.

However, another strange observation (see animation):
1. if you duplicate the triangle and squeeze it the stroke will get non-uniform within the triangle
2. if you duplicate the squeezed triangle and convert it to path (Shift+Ctrl+C) the stroke stays as it was
3. ONLY if you move the path-triangle the stroke gets suddenly equal on all sides. Isn't that pretty strange? Is this some stroke-width updating problem?

ScaledPolygon.gif
ScaledPolygon.gif (134.87 KiB) Viewed 1367 times
Win7/64, Inkscape 0.92.2

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

Re: Linewidth of scaled polygons

Postby Moini » Fri Apr 13, 2018 6:16 am

A stroke is a stroke and can be scaled or not


Yes. The stroke can be scaled.

However, what you're doing here is squashing the whole figure, and that figure cannot change in its width, because it is a same-sided triangle, and always will be. So all you can do is squash the whole triangle. You can scale that triangle's stroke, but it's still going to be squashed.

Isn't that pretty strange?


Yes, and if you had different settings in your preferences selected, that make sure that transforms are kept, then it wouldn't even change if you move it.

Is this some stroke-width updating problem?


No, the reason is that the transform is still applied to the figure. When you move it, the path data will be rewritten to eliminate the transform matrix that squashes the figure. This will move the actual nodes into their correct places.
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”