stipplegen
stipplegen copied to clipboard
Feature request- export voronoi cell as svg
It would be also usable, to be able to export the voronoi cells as a svg. Best regards
I would also be interested in this functionality. I attempted to create a vector output for the voronoi cells by making the following changes to the end of the draw function.
if (saveNow) {
statusDisplay = "Saving SVG File";
saveNow = false;
fileOutput = loadStrings("header.txt");
String rowTemp;
float SVGscale = (800.0 / (float) mainheight);
int xOffset = (int)(1600 - (SVGscale * mainwidth / 2));
int yOffset = (int)(400 - (SVGscale * mainheight / 2));
if (fileModeTSP) { // Plot the PATH between the points only.
println("Save TSP File (SVG)");
for (Polygon2D poly : voronoi.getRegions()) {
// Path header::
rowTemp = "<path style=\"fill:none;stroke:black;stroke-width:2px;stroke-linejoin:round;stroke-linecap:round;\" d=\"M ";
fileOutput = append(fileOutput, rowTemp);
for (Vec2D v : poly.vertices) {
float xTemp = v.x;
float yTemp = v.y;
rowTemp = xTemp + " " + yTemp + "\r";
fileOutput = append(fileOutput, rowTemp);
}
rowTemp = "Z";
fileOutput = append(fileOutput, rowTemp);
fileOutput = append(fileOutput, "\" />"); // End path description
}
} else {
println("Save Stipple File (SVG)");
This seems to only output a less "evolved" version of the voronoi cells, But I dont know exactly what im doing here so perhaps you could offer some assistance!