On 02/09/2022 18:58, andrew goh via Discuss wrote:
While doing this attempt, I realized there is some 'secrets' for
W3C's SVG cubic bezier curves. They are actually 'locally referenced'
at the origin for the first control (end) point. The whole beizer
curve is then translated with this first control point (which is the
origin) to the desired position (i.e. the SVG coordinates for the 1st
control point). if you used the true absolute coordinates, for the
bezier calculations totally different Bezier curves are created.
For now the Inkscape extension i'd guess works, I've not tried it out
really. But that having a similar implementation makes it easier to
integrate the 'graphical' front end apps, with other inkscape
scripts. It'd certainly be more difficult I'd guess for Bezier surfaces
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I wrote a console c++ program, that takes any svg file created by
openscad, and converts it to polygons, and also you can set approximate
point spacing, and it inserts the intermediate points at that spacing.
more or less (it binary chops until the distance is less than what was
set), and saves that as a list of points, which can be simply pasted
into openscad. It is a bit hand cranked, but works well enough for me.
I'm thinking of doing similar for 3d (stl files) which at the moment can
be expressed quite succinctly for importing to openscad, (I mentioned
that a couple of days ago on here) although in that case I would be
poking/prodding the file in a c++ program, but afaik, openscad does not
export stl's as ascii, but it is easy to convert from binary to ascii
elsewhere, or I could learn the binary format it uses. But ascii is
easier to test, since the file can be altered in any text editor.
With svg, there is some loss of information, in as much that thinking of
a letter 'o', say, the the hollowed out part is merely background
swapped for foreground colours, and vice versa. Too much of a faff at
the moment for me to go through all the polygons, and decide which ones
lie inside others to difference them appropriately when fed back into
openscad, although I expect, if I looked at it, it would be pretty easy.
Best wishes,
Ray
Thanks,
I think I'd try the STL approach, as OpenSCAD can import STL files in a
fairly straightforward manner.
That'd likely be for the Bezier surfaces and maybe NURBS surfaces.
An example is to model the Utah Teapot as a 'first cut' attempt.
https://www.scratchapixel.com/lessons/geometry/bezier-curve-rendering-utah-teapot
https://www.scratchapixel.com/lessons/geometry/bezier-curve-rendering-utah-teapot
I'd guess unlike general computer graphics, 3d solid modelling has to be
solids. Hence, it is more complex than simply stitching surfaces together.
While things like Bezier surfaces and NURBS surfaces are simply 'thin'
surfaces, they do not constitute "solids". That I'd guess is part of the
challenges of integrating say NURBS into OpenSCAD.
There are a lot of such "organic" looking things and models all around
us. The thing is they do not normally fall into the ideal geometries
such as cubes, cylinders, cones, spheres, etc.
Cheers,
Andrew
On 03/09/2022 03:23, Raymond West wrote:
On 02/09/2022 18:58, andrew goh via Discuss wrote:
I wrote a console c++ program, that takes any svg file created by
openscad, and converts it to polygons, and also you can set
approximate point spacing, and it inserts the intermediate points at
that spacing. more or less (it binary chops until the distance is less
than what was set), and saves that as a list of points, which can be
simply pasted into openscad. It is a bit hand cranked, but works well
enough for me.
I'm thinking of doing similar for 3d (stl files) which at the moment
can be expressed quite succinctly for importing to openscad, (I
mentioned that a couple of days ago on here) although in that case I
would be poking/prodding the file in a c++ program, but afaik,
openscad does not export stl's as ascii, but it is easy to convert
from binary to ascii elsewhere, or I could learn the binary format it
uses. But ascii is easier to test, since the file can be altered in
any text editor.
With svg, there is some loss of information, in as much that thinking
of a letter 'o', say, the the hollowed out part is merely background
swapped for foreground colours, and vice versa. Too much of a faff at
the moment for me to go through all the polygons, and decide which
ones lie inside others to difference them appropriately when fed back
into openscad, although I expect, if I looked at it, it would be
pretty easy.
Best wishes,
Ray
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I stumbled into one of the user "success stories" of SVG to OpenSCAD
Bezier - InkScape extension
https://www.thingiverse.com/thing:2805184
https://www.thingiverse.com/thing:2805184
Air100 Rc glider
https://www.thingiverse.com/thing:4175598
https://www.thingiverse.com/thing:4175598
things like this glider that looks 'simple' are 'hard to model' in
OpenSCAD as they do not necessary conform to assemblies of 'fixed'
geometries, cubes, cylinders, cones, spheres etc.
On 03/09/2022 03:42, andrew goh wrote:
Thanks,
I think I'd try the STL approach, as OpenSCAD can import STL files in
a fairly straightforward manner.
That'd likely be for the Bezier surfaces and maybe NURBS surfaces.
An example is to model the Utah Teapot as a 'first cut' attempt.
https://www.scratchapixel.com/lessons/geometry/bezier-curve-rendering-utah-teapot
https://www.scratchapixel.com/lessons/geometry/bezier-curve-rendering-utah-teapot
I'd guess unlike general computer graphics, 3d solid modelling has to
be solids. Hence, it is more complex than simply stitching surfaces
together.
While things like Bezier surfaces and NURBS surfaces are simply 'thin'
surfaces, they do not constitute "solids". That I'd guess is part of
the challenges of integrating say NURBS into OpenSCAD.
There are a lot of such "organic" looking things and models all around
us. The thing is they do not normally fall into the ideal geometries
such as cubes, cylinders, cones, spheres, etc.
Cheers,
Andrew
On 03/09/2022 03:23, Raymond West wrote:
On 02/09/2022 18:58, andrew goh via Discuss wrote:
I wrote a console c++ program, that takes any svg file created by
openscad, and converts it to polygons, and also you can set
approximate point spacing, and it inserts the intermediate points at
that spacing. more or less (it binary chops until the distance is
less than what was set), and saves that as a list of points, which
can be simply pasted into openscad. It is a bit hand cranked, but
works well enough for me.I'm thinking of doing similar for 3d (stl files) which at the moment
can be expressed quite succinctly for importing to openscad, (I
mentioned that a couple of days ago on here) although in that case I
would be poking/prodding the file in a c++ program, but afaik,
openscad does not export stl's as ascii, but it is easy to convert
from binary to ascii elsewhere, or I could learn the binary format it
uses. But ascii is easier to test, since the file can be altered in
any text editor.With svg, there is some loss of information, in as much that thinking
of a letter 'o', say, the the hollowed out part is merely background
swapped for foreground colours, and vice versa. Too much of a faff at
the moment for me to go through all the polygons, and decide which
ones lie inside others to difference them appropriately when fed back
into openscad, although I expect, if I looked at it, it would be
pretty easy.Best wishes,
Ray
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org