On 05/20/2016 04:14 PM, Alexander Brock wrote:
I made a lib2geom toy which creates stitches especially for
hair-like
effects where an area should be filled with lines similar to a given curve:
http://i.imgur.com/bx829Uk.png
Code is in the src/toys/hair* files:
https://github.com/abrock/lib2geom
It works the following way:
1. Create offset curves until there is no intersection between curve and
offset curve.
2. Create equidistant stitches on the middle curve
3. Create stitches similar to the ones on the middle curve on all other
curves
4. Calculate intersections between curves and area outline. Throw away
stitches outside the area.
5. Find the best ordering of lines so the amount of stitches along the
area outline for connecting different parts is minimized. I do the
connecting stitches along the outline since I sometimes want to use a
very low density of lines and then I can't hide the connecting stitches
under "future lines".
Update:
I made an executable called "hair" which takes two filenames as command
line arguments ($outline.svgd and $path.svgd). The contents are read by
read_svgd, I usually just copy the content from a SVG file.
The stitches are computed and the result is written in $outline.svgd.svg
/ $outline.svgd.txt. The .txt file can be converted to many different
embroidery formats by libembroider-convert:
https://github.com/Embroidermodder/Embroidermodder
I applied the method to mane and tail of this vector:
http://imageconstructor.deviantart.com/art/Luna-545158121
Here you can see the results (input paths and embroidered versions):
http://imgur.com/a/bRrko
http://imgur.com/a/LVs8j
http://imgur.com/a/d0sc1
I tried to make the stitches follow the direction of the hairs.
One problem is that Inkscape::half_outline sometimes increases the
number of nodes which leads to exponential node count increase when
applied repeatedly:
http://imgur.com/a/doJaU
Is there an alternative? If not I might have to write one.
Best Regards,
Alexander