discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

larger number of control points for Bezier

J
jon
Mon, Oct 23, 2017 6:39 PM

I am toying around with modeling an electric guitar body in OpenSCAD. 
Google "Gibson SG" for an idea about the body shape. In order to create
the shape, I need between 10 and 20 control points (for one side of the
guitar body: the other side is [fortunately] a mirror image).  I found
some code that will handle 4 control points, and some that will handle
8, but nothing that will handle "n" points.  I suppose I could try to do
this with a series of 4-point or 8 point curves, but would prefer to do
it with one curve.

Any insights into this?  My quick perusal of the existing code implies
that one needs "n" hand-coded functions when handling "n" points, which
is why the previous authors went with fixed numbers of 4 and 8.

Jon

--
Sent from my desktop computer.
I do not receive emails while away from my desk,
nor do I receive texts on my main phone number
(which is a land line).
If you know that I am on the road, please text me.
If you know that I am home, please email me.

I am toying around with modeling an electric guitar body in OpenSCAD.  Google "Gibson SG" for an idea about the body shape. In order to create the shape, I need between 10 and 20 control points (for one side of the guitar body: the other side is [fortunately] a mirror image).  I found some code that will handle 4 control points, and some that will handle 8, but nothing that will handle "n" points.  I suppose I could try to do this with a series of 4-point or 8 point curves, but would prefer to do it with one curve. Any insights into this?  My quick perusal of the existing code implies that one needs "n" hand-coded functions when handling "n" points, which is why the previous authors went with fixed numbers of 4 and 8. Jon -- Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me.
M
moshel
Mon, Oct 23, 2017 7:38 PM

try dotscad, https://github.com/JustinSDK/dotSCAD
its a really good library, with lots of useful modules. the bezier_curve
(https://openhome.cc/eGossip/OpenSCAD/lib-bezier_curve.html) can probably do
what you want, although you might find it easier to use a few sets of curves
as the curves are a bit harder to control with more than 4 points.

--
Sent from: http://forum.openscad.org/

try dotscad, https://github.com/JustinSDK/dotSCAD its a really good library, with lots of useful modules. the bezier_curve (https://openhome.cc/eGossip/OpenSCAD/lib-bezier_curve.html) can probably do what you want, although you might find it easier to use a few sets of curves as the curves are a bit harder to control with more than 4 points. -- Sent from: http://forum.openscad.org/
RP
Ronaldo Persiano
Mon, Oct 23, 2017 11:28 PM

I don't believe you could get the shape of Gibson SG with one or two Bezier
curves, even with 20 control points. One alternative is to use
interpolation splines instead of Bezier. See for instance, the library
http://www.thingiverse.com/thing:1208001. However, you may find difficult
to position the input points to interpolate in order to get the curve you
have in mind. A better approach is to use B-splines or even NURBS but I
don't know any published OpenSCAD library with them.

I don't believe you could get the shape of Gibson SG with one or two Bezier curves, even with 20 control points. One alternative is to use interpolation splines instead of Bezier. See for instance, the library http://www.thingiverse.com/thing:1208001. However, you may find difficult to position the input points to interpolate in order to get the curve you have in mind. A better approach is to use B-splines or even NURBS but I don't know any published OpenSCAD library with them. > >
RW
Rob Ward
Mon, Oct 23, 2017 11:45 PM

I would suggest loading an image into InkScape and using as many Bezier segments (ie one line as you wish) to map it. Then import that into OpenSCAD and either use extrusions of 2D shape to "build" the body or at least use it as a visual check on what choose to do instead of extrusion. Some compromise will be required in this as the guitar body is not a standard OpenSCAD geometric shape, the smooth curves will be reduced to planar segments at some stage. However understanding the resolution of your printer will help you achieve a workable compromise when the spline curves are quantised into segments (ie in Inkscape or OpenSCAD import).

--
Rob

I would suggest loading an image into InkScape and using as many Bezier segments (ie one line as you wish) to map it. Then import that into OpenSCAD and either use extrusions of 2D shape to "build" the body or at least use it as a visual check on what choose to do instead of extrusion. Some compromise will be required in this as the guitar body is not a standard OpenSCAD geometric shape, the smooth curves will be reduced to planar segments at some stage. However understanding the resolution of your printer will help you achieve a workable compromise when the spline curves are quantised into segments (ie in Inkscape or OpenSCAD import). -- Rob
MS
Mark Schafer
Tue, Oct 24, 2017 2:37 AM

I.e. https://www.thingiverse.com/thing:1065500

On 10/24/2017 12:45 PM, Rob Ward wrote:

I would suggest loading an image into InkScape and using as many
Bezier segments (ie one line as you wish) to map it. Then import that
into OpenSCAD and either use extrusions of 2D shape to "build" the
body or at least use it as a visual check on what choose to do instead
of extrusion. Some compromise will be required in this as the guitar
body is not a standard OpenSCAD geometric shape, the smooth curves
will be reduced to planar segments at some stage. However
understanding the resolution of your printer will help you achieve a
workable compromise when the spline curves are quantised into segments
(ie in Inkscape or OpenSCAD import).

--
Rob

I.e. https://www.thingiverse.com/thing:1065500 On 10/24/2017 12:45 PM, Rob Ward wrote: > I would suggest loading an image into InkScape and using as many > Bezier segments (ie one line as you wish) to map it. Then import that > into OpenSCAD and either use extrusions of 2D shape to "build" the > body or at least use it as a visual check on what choose to do instead > of extrusion. Some compromise will be required in this as the guitar > body is not a standard OpenSCAD geometric shape, the smooth curves > will be reduced to planar segments at some stage. However > understanding the resolution of your printer will help you achieve a > workable compromise when the spline curves are quantised into segments > (ie in Inkscape or OpenSCAD import). > > -- > Rob
O
oystein.krog
Tue, Oct 24, 2017 8:49 AM

Does it really have to be bezier curves?
I would recommend trying to use cubic natural splines instead, Parkinbot has
a great nSpline function/library that allows you to do what you want.

--
Sent from: http://forum.openscad.org/

Does it really have to be bezier curves? I would recommend trying to use cubic natural splines instead, Parkinbot has a great nSpline function/library that allows you to do what you want. -- Sent from: http://forum.openscad.org/
J
jon
Tue, Oct 24, 2017 11:44 AM

I often feel like a child among graduate students with you guys. I
thought what I was trying to do was simple (create a smooth exterior
curve for the guitar body) and all I needed was a "smoothing function"
of some sort.  I do not understand the difference between Bezier and
splines: they both are magic to me. But Bezier appears to work to smooth
a curved line on a plane, while Parkinbot's splines appear to work on a
3D surface.  Is there a way to use Parkinbot's splines for the simpler
line-on-a-plane case?

Sorry for being so clueless.

Jon

On 10/24/2017 4:49 AM, oystein.krog wrote:

Does it really have to be bezier curves?
I would recommend trying to use cubic natural splines instead, Parkinbot has
a great nSpline function/library that allows you to do what you want.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
Sent from my desktop computer.
I do not receive emails while away from my desk,
nor do I receive texts on my main phone number
(which is a land line).
If you know that I am on the road, please text me.
If you know that I am home, please email me.

I often feel like a child among graduate students with you guys. I thought what I was trying to do was simple (create a smooth exterior curve for the guitar body) and all I needed was a "smoothing function" of some sort.  I do not understand the difference between Bezier and splines: they both are magic to me. But Bezier appears to work to smooth a curved line on a plane, while Parkinbot's splines appear to work on a 3D surface.  Is there a way to use Parkinbot's splines for the simpler line-on-a-plane case? Sorry for being so clueless. Jon On 10/24/2017 4:49 AM, oystein.krog wrote: > Does it really have to be bezier curves? > I would recommend trying to use cubic natural splines instead, Parkinbot has > a great nSpline function/library that allows you to do what you want. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > -- Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me.
RP
Ronaldo Persiano
Tue, Oct 24, 2017 12:03 PM

If all your "control points" are in a plane, Bezier and splines will be in
their plane. I am quite sure (but haven't check it) that Parkinbot's spline
library will work with with 2D control points as well.

Em 24 de out de 2017 09:45, "jon" jon@jonbondy.com escreveu:

I often feel like a child among graduate students with you guys. I thought
what I was trying to do was simple (create a smooth exterior curve for the
guitar body) and all I needed was a "smoothing function" of some sort.  I
do not understand the difference between Bezier and splines: they both are
magic to me. But Bezier appears to work to smooth a curved line on a plane,
while Parkinbot's splines appear to work on a 3D surface.  Is there a way
to use Parkinbot's splines for the simpler line-on-a-plane case?

Sorry for being so clueless.

Jon

On 10/24/2017 4:49 AM, oystein.krog wrote:

Does it really have to be bezier curves?
I would recommend trying to use cubic natural splines instead, Parkinbot
has
a great nSpline function/library that allows you to do what you want.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
Sent from my desktop computer.
I do not receive emails while away from my desk,
nor do I receive texts on my main phone number
(which is a land line).
If you know that I am on the road, please text me.
If you know that I am home, please email me.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

If all your "control points" are in a plane, Bezier and splines will be in their plane. I am quite sure (but haven't check it) that Parkinbot's spline library will work with with 2D control points as well. Em 24 de out de 2017 09:45, "jon" <jon@jonbondy.com> escreveu: > I often feel like a child among graduate students with you guys. I thought > what I was trying to do was simple (create a smooth exterior curve for the > guitar body) and all I needed was a "smoothing function" of some sort. I > do not understand the difference between Bezier and splines: they both are > magic to me. But Bezier appears to work to smooth a curved line on a plane, > while Parkinbot's splines appear to work on a 3D surface. Is there a way > to use Parkinbot's splines for the simpler line-on-a-plane case? > > Sorry for being so clueless. > > Jon > > > On 10/24/2017 4:49 AM, oystein.krog wrote: > >> Does it really have to be bezier curves? >> I would recommend trying to use cubic natural splines instead, Parkinbot >> has >> a great nSpline function/library that allows you to do what you want. >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> > -- > Sent from my desktop computer. > I do not receive emails while away from my desk, > nor do I receive texts on my main phone number > (which is a land line). > If you know that I am on the road, please text me. > If you know that I am home, please email me. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
M
MathLover
Tue, Oct 24, 2017 2:32 PM

I would use a 2D CAD program to import a foto or drawing and draw the shape
on top of that. LibreCAD could probably do that. Or Inkscape, as was already
suggested. Then, you can export the (closed!) shape as DXF and import it
into OpenSCAD to extrude it.

Those 2D programs also allow you to draw an inner offset, so you can use a
Minkowski sum to add rounded corners to the body. Off course, the part where
the neck is attached should be taken care of separately.

--
Sent from: http://forum.openscad.org/

I would use a 2D CAD program to import a foto or drawing and draw the shape on top of that. LibreCAD could probably do that. Or Inkscape, as was already suggested. Then, you can export the (closed!) shape as DXF and import it into OpenSCAD to extrude it. Those 2D programs also allow you to draw an inner offset, so you can use a Minkowski sum to add rounded corners to the body. Off course, the part where the neck is attached should be taken care of separately. -- Sent from: http://forum.openscad.org/
G
Gadgetmind
Tue, Oct 24, 2017 3:10 PM

On 2017-10-24 13:03, Ronaldo Persiano wrote:

I am quite sure (but haven't check it) that Parkinbot's spline library
will work with with 2D control points as well.

I often used with 2D data, and sometimes with 4/5/6 D data!

This is done when I want to move a (say) circle along a path. I have X/Y
data, and also size of disc and its angle, etc. as control points.
NSpline then smooths this data and I can use transformations on circle
points returned from a function to get all the required points to use
finally use skin ().

Most of these teapots that I recently designed and printed for a charity
use this approach in various (slightly hacky!) ways.

https://www.thingiverse.com/thing:2590540

On 2017-10-24 13:03, Ronaldo Persiano wrote: > I am quite sure (but haven't check it) that Parkinbot's spline library > will work with with 2D control points as well. I often used with 2D data, and sometimes with 4/5/6 D data! This is done when I want to move a (say) circle along a path. I have X/Y data, and also size of disc and its angle, etc. as control points. NSpline then smooths this data and I can use transformations on circle points returned from a function to get all the required points to use finally use skin (). Most of these teapots that I recently designed and printed for a charity use this approach in various (slightly hacky!) ways. https://www.thingiverse.com/thing:2590540