- From: Felipe Sanches <juca@members.fsf.org>
- Date: Thu, 24 Jul 2014 17:57:35 -0300
- To: SVG WG <www-svg@w3.org>
- Message-ID: <CAK6XL6C8rvqUvONFSdnhP6VQVAXXJDo+7ozHPMN1AjX1i2x62Q@mail.gmail.com>
Hello, I've been working with the OpenSCAD tool [http://www.openscad.org] for generating both 3d models but also 2d vectors. It is a very nice tool and sometimes I feel it is easier to write a tiny script in OpenSCAD and export it as SVG instead of directly drawing the shapes in Inkscape. I have been wondering about the possibility of the SVG standard incorporating certain features that we can see in OpenSCAD. One such feature is the generation of convex hull polygons. Please consider this snippet of OpenSCAD scripting (the resulting shape is in the attached image): length = 10; radius = 2; module arrow() { translate([0,radius]) hull(){ translate([-length/2, length/2]) circle(r=radius); for (i=[0,1]){ for (j=[0,1]){ translate([i*length, j*length]) circle(r=radius); } } } } module cross(){ translate([length/2, length/2 + radius]){ square([length, radius], center=true); square([radius, length], center=true); } } module plus_arrow(){ difference(){ arrow(); cross(); } } plus_arrow(); It would be nice to be able to draw a few circles and apply a convex hull operator to them. So, my proposed SVG feature would represent the arrow() with something like: <svg> <hull> <circle cx="0" cy="1" r="2" /> <circle cx="0" cy="11" r="2" /> <circle cx="10" cy="1" r="2" /> <circle cx="10" cy="11" r="2" /> <circle cx="-5" cy="6" r="2" /> <hull/> </svg> happy hacking, Felipe "Juca" Sanches PS: If you are really going to run this script yourself, beware that I ommitted an OpenSCAD detail: $fn=80; //resolution of segmentation to use when using a polygon to represent a curved shape
Attachments
- image/png attachment: OpenSCAD_-_plus_arrow.png
Received on Thursday, 24 July 2014 20:58:03 UTC