Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ezheidtmann/polargraph-optimizer
Optimize drawing plan for a polargraph
https://github.com/ezheidtmann/polargraph-optimizer
Last synced: 2 months ago
JSON representation
Optimize drawing plan for a polargraph
- Host: GitHub
- URL: https://github.com/ezheidtmann/polargraph-optimizer
- Owner: ezheidtmann
- License: mit
- Created: 2014-10-18T00:31:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-03T19:25:26.000Z (about 9 years ago)
- Last Synced: 2024-01-24T00:44:40.081Z (5 months ago)
- Language: Python
- Size: 1.36 MB
- Stars: 57
- Watchers: 19
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-plotters - Polargraph Optimizer - Optimize drawing plan for a polargraph. (Software / Vector Utilities)
README
polargraph-optimizer
====================Optimize drawing plan for a polargraph
Example Usage
----Optimize the included drawing plan `map.txt`:
```
$ time ./process.py map.txt > map_optimized.txt
Total Glyphs: 8074
Initial penup distance: 4107485
Initial total distance: 4742961
Deduped penup distance: 3494625
Deduped total distance: 4040278
Sorted penup distance: 5319295
Sorted total distance: 5864948
Greedy penup (i=0) 124384
Greedy total (i=0) 670037real 1m0.164s
user 1m0.088s
sys 0m0.024s
```Now `map_optimized.txt` includes a reordered drawing plan with duplicate glyphs removed and with an improved ordering.
About the algorithm
----The optimization algorithm is basically this:
* Remove path sections which are exact duplicates of earlier sections
* Reorder paths:
* Pick the first path as the first path in the input file
* Find the path that starts nearest the previous one's endpoint, or the one which, if reversed, would start nearest the previous one's endpoint
* Repeat until we have processed all pathsFor the drawing plan `map.txt` included, this results in a 7.1x improvement in total pen travel distance (see code for definition of distance). Actual results will vary due to a variety of factors. Please report real-life results so we can include them here!
Contributors
----[Evan Heidtmann](https://github.com/ezheidtmann)
[Olivier Bouwman](https://github.com/olivierbouwman)