Dashes

General discussions about Inkscape.
User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Dashes

Postby Espermaschine » Tue Mar 29, 2016 12:02 am

Just watched an Illustrator tutorial.
The teacher creates a sunburst by adding dashes to the circle-stroke.
Very simple and quick.

This doesnt work in Inkscape, but i dont understand why.
Attachments
Dashes.png
Dashes.png (14.99 KiB) Viewed 6044 times

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

Re: Dashes

Postby brynn » Tue Mar 29, 2016 12:13 am

Could be Illustrator just works differently than Inkscape, in this area?

After they make the circle with dashes, then what do they do?

I suppose I might use Stroke to Path, then manually add a new node for each dash. Then reveal transform handles, select only the new nodes, and scale outwards.

(I'd probably be as shocked to learn how much time you actually spend on YT, as you would be to learn how little time I spend, lol)

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: Dashes

Postby Espermaschine » Tue Mar 29, 2016 12:19 am

brynn wrote:Could be Illustrator just works differently than Inkscape, in this area ?

Sure :)

For learning its sometimes very useful to look beyond the confines of IS
I learned so many things about Gimp by watching Photoshop tutorials.

After they make the circle with dashes, then what do they do?

They are already done with the effect. Thats the neat thing.
Just imagine the spacing of the 10,3px stroke would stay that way, whatever the stroke-size is.

I suppose I might use Stroke to Path, then manually add a new node for each dash. Then reveal transform handles, select only the new nodes, and scale outwards.

I know how to make a sunburst in IS. I just want to understand the dash behaviour in Inkscape.

(I'd probably be as shocked to learn how much time you actually spend on YT, as you would be to learn how little time I spend, lol)

I dont watch tv and enjoy learning. ;)

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

Re: Dashes

Postby Lazur » Tue Mar 29, 2016 5:35 am

There are two factors as I see it.

Once, for "equal" dividing you need to define a custom dasharray -otherwise start/end dash would "look off".
Here comes the first problem, you don't know the exact length of the Bézier curves.
The measure path extension can give some hints, it relies on py modules, as seen in the codes:
import inkex
import simplestyle
import simpletransform
import cubicsuperpath
import bezmisc
Basically it means a "re-phrased" path/geometry is used.
Probably that is the second part of the problem,
because it seems the dasharray is assigned to such a recalculated path.
For comparison the pattern along path lpe gives a much more precise result for the same thing if you repeat a rectangle over the path.

test image

While drawing this, found that
the star tool>stitch subpaths lpe>pattern along path lpe>custom dasharray in accuracy.

Also that the pattern along path lpe can crash inkscape easily.
Every time using a pattern with 0 spacing that would show exactly as the pattern has the same long spacing as itself.
So instead, made the pattern 10 px shorter and added a 10 px spacing but that wasn't correct either, 9,98 spacing is looking better...


Probably the mentioned py modules are rendered different with each cairo version.
Pre 0.92 can render circular segments of paths "natively", without converting them to Bézier paths.
As in an example file from Suv about iso 3098 technical lettering.
(She is working on an extension similar to Hershey text, based on an svg with path of circular arcs.
Testing it on 0.91 the curves didn't come out right, that's why I'm guessing a new renderer could handle like cubicsuperpath module better. But from a logical view such a module always will "distort" the shape.)

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

Re: Dashes

Postby Polygon » Tue Mar 29, 2016 5:58 am

Deleted
Last edited by Polygon on Tue Mar 29, 2016 6:17 am, edited 1 time in total.

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

Re: Dashes

Postby Lazur » Tue Mar 29, 2016 6:05 am

Polygon wrote:Image


It shows a rather inaccurate result.
The inside of the curve the dashes look more like rectangles with no distortion but rotation, while
at the outside their lengths vary (at the bottom right object's left for example).
If it was all correct, you could make the stroke wider, making the dashes intersect at the centre of the curve, while now there is an interference, which is not even following the path visually.

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

Re: Dashes

Postby Polygon » Tue Mar 29, 2016 6:18 am

Sorry that you didn´t like the result.

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: Dashes

Postby Espermaschine » Tue Mar 29, 2016 6:21 am

@Lazur

I dont understand what you did with the cyan and white sunburst....

Cyan has Pap 'Single stretched' and custom dash of 1000px.
When i remove the Pap, it more or less stays the same...
So you created the sunburst with the dashes as in Helen Bradleys video ??
How ?

While the white one is made of Pap 'Repeated' and no stroke ???

What is the pattern ? A rectangle, right ?

Polygon wrote:Sorry that you didn´t like the result.

Well maybe i would have liked it...
Can you reupload your image, please !

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

Re: Dashes

Postby Lazur » Tue Mar 29, 2016 7:00 am

[off topic]
Polygon wrote:Sorry that you didn´t like the result.


It was't about taste/liking/anything personal.

Yet with only 6 years of experience what exactly could I contribute with anyway? My bad. Seriously I should get off already. This forum is going down the gutter anyway and any time (...), why waste effort on it? Why pointing out any obvious flaws when noone cares doing things right.[/off topic]

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

Re: Dashes

Postby Lazur » Tue Mar 29, 2016 7:14 am

Espermaschine wrote:I dont understand what you did with the cyan and white sunburst....

Cyan has Pap 'Single stretched' and custom dash of 1000px.
When i remove the Pap, it more or less stays the same...
So you created the sunburst with the dashes as in Helen Bradleys video ??
How ?

While the white one is made of Pap 'Repeated' and no stroke ???

What is the pattern ? A rectangle, right ?



Circle's diameter is 1000 px.
Cyan is a 1000px/1000px path with a dashed stroke, which is 1000 px wide and which has a 31.416, 31.416 dasharray, so it would render with 50 "rays".
Now that you mention it its pattern along path lpe was not intentional, added it "accidentally" at a point.
Will correct it.

Should only have the mentioned custom dasharray. You can edit that in the xml editor.
Add a dashed stroke, then at the style attributes browse the dasharray part and edit it as you like.

The white one's pattern was linked from the yellow path on the left edge of the page borders.

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

Re: Dashes

Postby Lazur » Tue Mar 29, 2016 9:02 am

Looking at your original image again, it looks that the link between the dasharray and the stroke width got you.
Dashes and gaps inbetween scale with the stroke widths. The values in the xml indicates the px sizes of them measured on the core path when the stroke width is set to 1 px.

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: Dashes

Postby Espermaschine » Tue Mar 29, 2016 6:35 pm

Still trying to wrap my head around this....
I downloaded the revised svg and its becoming clearer now.

EDIT: it still boggles my mind why a rectangle applied as a Pap to a circle gets distorted (?) into a triangular shape...
...although, if you zoom in, there is some funky overlapping pattern at the center.
So not exactly triangular.

Lazur URH wrote:Should only have the mentioned custom dasharray. You can edit that in the xml editor.
Add a dashed stroke, then at the style attributes browse the dasharray part and edit it as you like.

The xml editor is still a challenge for me. I googled "custom dash" but i find it hard to understand so far.

How did you come up with the number 31.416 ?
Is that Pi ?

Lazur URH wrote:Looking at your original image again, it looks that the link between the dasharray and the stroke width got you.
Dashes and gaps inbetween scale with the stroke widths. The values in the xml indicates the px sizes of them measured on the core path when the stroke width is set to 1 px.

Yeah, it seems to scale the dash instead of dividing the path into equal parts.

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Dashes

Postby v1nce » Wed Mar 30, 2016 3:11 am

Espermaschine wrote:Yeah, it seems to scale the dash instead of dividing the path into equal parts.


Which is what is expected.
Try with any shape but a circle (a rectangle, a line...) and think about what you'd expect from a 1(px) border

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: Dashes

Postby Espermaschine » Wed Mar 30, 2016 3:28 am

v1nce wrote:Which is what is expected.
Try with any shape but a circle (a rectangle, a line...) and think about what you'd expect from a 1(px) border

That seems logical but it also means i can never really give a 800x600px rectangle a dashed line with a 80px stroke, right ?
Wheres the mistake in my thinking ?

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

Re: Dashes

Postby Lazur » Wed Mar 30, 2016 8:52 am

You can, just use a shorter dasharray.
Like use the bottom-most on the list which is
;stroke-dasharray:1.8,1.8;

-meaning the 80 px wide stroke will have 144 px gaps in between, clearly visible on a 800 px/ 600 px sized rectangle.

Espermaschine wrote:How did you come up with the number 31.416 ?
Is that Pi ?


Yes. The circumference of the circle is 2*r*pi, so if the diameter was 1000 px, the circumference 3141,6 px;
31,416 is 1/100 of it, calling for "50 rays and 50 gaps".

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: Dashes

Postby Espermaschine » Wed Mar 30, 2016 6:03 pm

Lazur URH wrote:Yes. The circumference of the circle is 2*r*pi, so if the diameter was 1000 px, the circumference 3141,6 px;
31,416 is 1/100 of it, calling for "50 rays and 50 gaps".

Interesting !
The math is a bit of a turnoff for me.
None the less, its good to know !

jabiertxof
Posts: 184
Joined: Wed Feb 06, 2013 6:47 am

Re: Dashes

Postby jabiertxof » Sun Apr 01, 2018 11:58 am

Hi I Just commit a LPE on trunk. Thanks Lazur for the feedback.
https://archive.org/details/dash-stroke-lpe

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

Re: Dashes

Postby brynn » Sun Apr 01, 2018 11:12 pm

Will it be available in version 0.93 ?

jabiertxof
Posts: 184
Joined: Wed Feb 06, 2013 6:47 am

Re: Dashes

Postby jabiertxof » Mon Apr 02, 2018 4:38 am

Yes is now in master. I just commit a new feature hope today is merged. here is a pic:
https://inkscape.org/en/~jabiertxof/%E2 ... hes-option


Return to “General Discussions”