pyembroidery icon indicating copy to clipboard operation
pyembroidery copied to clipboard

Update stitching methods

Open delpreto opened this issue 3 years ago • 1 comments

Updating stitchification methods and visualizations.

  • Handle SVG files with any number of paths.
  • Use a new method to compute intersections between line segments. It uses cross products, is robust to horizontal/vertical segments, and detects if there is no intersection.
  • Remove consecutive duplicate points from the extracted SVG control points, which seems common and does not always start with the first point.
  • Ignore any empty paths extracted from the SVG file.
  • Add stitches in an order that preserves the original SVG path directionality.
  • For each segment in an SVG path, compute intersections with each other path then add stitches in each inter-intersection section according to the desired pitch (avoiding the intersections themselves).
  • Optionally animate the stitches to visualize the embroidery sequence.
  • Allowing PyPlot to choose a good marker size when visualizing the stitch pattern.
  • Testing with SVGs that have 1, 2, or 3 paths, and an SVG that has all 8 paths.

delpreto avatar Apr 13 '22 04:04 delpreto

While I have no little doubt this is fine code. The pyembroidery library can't have any dependencies. It's intended to be and remain low level hyper-focused on reading and writing embroidery formats. It's intended to be a building block for the embroidery IO part of any script.

This code contains requirements for numpy, matplotlib, svgpathtools, and scipy. I can't shoehorn uses of pyembroidery into also needing those dependencies. I'd be happy to provide links to higher level work utilizing the library but I can't add, even solid work which does something other than format corrections or low level helper functions without requirements.

tatarize avatar Apr 18 '22 04:04 tatarize