I think i want to give the possibility of importing shapes that are a bit to verbose to code by hand.
SVG is pretty easy to parse (Inkscape's version at least), has abs and rel dimensions and apart from bezier curves, all the other components of a path object translate directly to gcode.
https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
Bezier curves are easy enough to convert to and array of segments using linear interpolation.
http://jamie-wong.com/post/bezier-curves/
Tools like Inkscape already have functions for outlines, which can help make pocket opps.
There are svg parser libraries, but I think I can extract the useful data in a simpler, easier to understand way. It will be a fun learning exercise none the less.
The only question would be:
Write a live parser in c that extracts the paths and converts them to point arrays every time the program is generated?
Or write a converter that extracts them to header file?
A clear goal of this project is to use easy to read C code. With that in mind I think the first option will look better, but for complex shapes, the execution time would be very slow without threads. We may have to go to threads eventually, but i want to avoid it as much as possible along with any extra library for that matter.
Either way, an svg parser/converter is next.
I think i want to give the possibility of importing shapes that are a bit to verbose to code by hand. SVG is pretty easy to parse (Inkscape's version at least), has abs and rel dimensions and apart from bezier curves, all the other components of a path object translate directly to gcode. https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths Bezier curves are easy enough to convert to and array of segments using linear interpolation. http://jamie-wong.com/post/bezier-curves/
Tools like Inkscape already have functions for outlines, which can help make pocket opps. There are svg parser libraries, but I think I can extract the useful data in a simpler, easier to understand way. It will be a fun learning exercise none the less.
The only question would be:
A clear goal of this project is to use easy to read C code. With that in mind I think the first option will look better, but for complex shapes, the execution time would be very slow without threads. We may have to go to threads eventually, but i want to avoid it as much as possible along with any extra library for that matter. Either way, an svg parser/converter is next.