polyline-converter
v0.1.1
Published
Convert polyline data to/from CSV, JSON, G-Code and ThetaRho
Downloads
2
Maintainers
Readme
Polyline Converter
Convert a polyline (a series of points) from one format to another.
This initial version converts a CSV file of rectangular (Cartesian) coordinates to the polar "Theta-Rho" notation used by Sisyphus Tables.
In future versions I plan to offer:
- Theta-Rho to rectangular conversion in CSV, JSON and G-code formats.
- G-Code to Theta-Rho
I may also support rectangular reformatting for CSV to JSON and vice versa.
Important Note about Rectangular to Theta-Rho Conversion
When converting from the x/y position of rectangular coordinates to the angle/radius position of polar/Theta-Rho coordinates it is important to remember that a straight line between two rectangular points will not be a straight line in polar coordinates. In order to build a straight line in THR coordinates, the rectangular coordinates must first be subdivided into smaller line segments to minimize the arcing effect of THR point-to-point segments. This is handled in this code by passing a second "max_segment_length" parameter to ThetaRho.convert().
Installation
npm install @markroland/polyline-converter
Command Line Usage
node ./index.js [input filepath] thr > output.thr
Tip, if npm link
has been used you can use:
convert-polyline [input filepath] thr > output.thr
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.