Editing Generating TSP art from a stippled image
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 24: | Line 24: | ||
* tspsolution.py | * tspsolution.py | ||
− | These three files are hosted at the Eggbot | + | These three files are hosted at the Eggbot code site, |
− | :[ | + | :[http://code.google.com/p/eggbotcode/downloads/list http://code.google.com/p/eggbotcode/downloads/list] |
Download the lastest version of the tsp_art_tools zip file, tsp_art_tools_x_y.zip. After you unzip that file, you will see those three files within it. Copy those files to a convenient work directory. | Download the lastest version of the tsp_art_tools zip file, tsp_art_tools_x_y.zip. After you unzip that file, you will see those three files within it. Copy those files to a convenient work directory. | ||
Line 62: | Line 62: | ||
:<tt>% python tspart.py --count zebra.pbm</tt><br/> | :<tt>% python tspart.py --count zebra.pbm</tt><br/> | ||
:<tt>Loading bitmap file ../zebra.pbm ... done; 3201 stipples</tt> | :<tt>Loading bitmap file ../zebra.pbm ... done; 3201 stipples</tt> | ||
− | |||
− | |||
When running the linkern solver, tspart.py tells linkern to do three successive runs over the data. Each run refines the results of the prior run. You can control the number of runs with the <tt>--runs</tt> option. For example, | When running the linkern solver, tspart.py tells linkern to do three successive runs over the data. Each run refines the results of the prior run. You can control the number of runs with the <tt>--runs</tt> option. For example, | ||
Line 77: | Line 75: | ||
On the other hand, if you want a single, closed path drawn then specify <tt>--max-segments=0</tt>. Using a value of zero tells tspart.py to put the entire TSP solution into a single SVG path. Of course, your SVG viewer needs to be able to handle the single path which results, even if it has thousands or tens of thousands of line segments. | On the other hand, if you want a single, closed path drawn then specify <tt>--max-segments=0</tt>. Using a value of zero tells tspart.py to put the entire TSP solution into a single SVG path. Of course, your SVG viewer needs to be able to handle the single path which results, even if it has thousands or tens of thousands of line segments. | ||
− | When using <tt>--max-segments=0</tt>, you can also specify a fill color. By default, the closed path has an SVG fill value of "none". You can select any SVG color name (e.g., blue, red, orange, etc.), or you can specify hexadecimal RGB values using the #rrggbb notation (e.g., #ff0000 for red). For example, | + | When using <tt>--max-segments=0</tt>, you can also specify a fill color. By default, the closed path has an SVG fill value of "none". You can select any SVG color name (e.g., "blue", 'red", "orange", etc.), or you can specify hexadecimal RGB values using the #rrggbb notation (e.g., #ff0000 for red). For example, |
− | :<tt>% python tspart.py --max-segments= | + | :<tt>% python tspart.py --max-segments=250 --fill=#00ffcc --runs=1 zebra.pbm</tt> |
− | produced | + | produced |
− | http:// | + | http://mtbaldy.us/~dnewman/tspart/filled-zebra.png |
− | To obtain a listing | + | To obtain a listing of tspart.py's options, use the <tt>--help</tt> option, |
:<tt>% python tspart.py --help</tt><br/> | :<tt>% python tspart.py --help</tt><br/> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Notes for Windows users == | == Notes for Windows users == | ||
Line 146: | Line 111: | ||
:<tt>C:\Program Files\inkscape> <b>python\python C:\tspart.py C:\image.pbm</b></tt><br/> | :<tt>C:\Program Files\inkscape> <b>python\python C:\tspart.py C:\image.pbm</b></tt><br/> | ||
− | In the above command, it is assumed that tspart.py, tspbitcity.py, tspsolution.py, and image.pbm are all in the top-level directory of the C: drive. Be sure to give the correct path to those files | + | In the above command, it is assumed that tspart.py, tspbitcity.py, tspsolution.py, and image.pbm are all in the top-level directory of the C: drive. Be sure to give the correct path to those files. |
== Notes for Mac users == | == Notes for Mac users == |