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:
Code is in the src/toys/hair* files:
It works the following way:
- 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:
I applied the method to mane and tail of this vector:
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:
Is there an alternative? If not I might have to write one.
Best Regards, Alexander