discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Passing lots of points to polygon(...) results in lower resolution

G
GooperMC
Sat, Mar 19, 2016 9:51 PM

I have a project where I am trying to model a involute curve.  I have a
function which returns a list of points where one of the parameters is how
many points it should return.  When it generates a few points the curve
actually looks smoother than when I generate lots of points.  When I
generate tons of points (more than lots :) ) it actually doesn't display
anything at all.

Here is a screen shot of simplified code which demonstrates the problem and
the generated shapes:
http://forum.openscad.org/file/n16584/involute-curve.png

I'm a noob with OpenSCAD so I'm probably doing something stupid.  Thanks for
any help!

--
View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have a project where I am trying to model a involute curve. I have a function which returns a list of points where one of the parameters is how many points it should return. When it generates a few points the curve actually looks smoother than when I generate lots of points. When I generate tons of points (more than lots :) ) it actually doesn't display anything at all. Here is a screen shot of simplified code which demonstrates the problem and the generated shapes: <http://forum.openscad.org/file/n16584/involute-curve.png> I'm a noob with OpenSCAD so I'm probably doing something stupid. Thanks for any help! -- View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Sat, Mar 19, 2016 9:56 PM

This sounds like a known bug,
https://github.com/openscad/openscad/issues/999

On 19 March 2016 at 17:51, GooperMC saul.jaspan@gmail.com wrote:

I have a project where I am trying to model a involute curve.  I have a
function which returns a list of points where one of the parameters is how
many points it should return.  When it generates a few points the curve
actually looks smoother than when I generate lots of points.  When I
generate tons of points (more than lots :) ) it actually doesn't display
anything at all.

Here is a screen shot of simplified code which demonstrates the problem and
the generated shapes:
http://forum.openscad.org/file/n16584/involute-curve.png

I'm a noob with OpenSCAD so I'm probably doing something stupid.  Thanks
for
any help!

--
View this message in context:
http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

This sounds like a known bug, https://github.com/openscad/openscad/issues/999 On 19 March 2016 at 17:51, GooperMC <saul.jaspan@gmail.com> wrote: > I have a project where I am trying to model a involute curve. I have a > function which returns a list of points where one of the parameters is how > many points it should return. When it generates a few points the curve > actually looks smoother than when I generate lots of points. When I > generate tons of points (more than lots :) ) it actually doesn't display > anything at all. > > Here is a screen shot of simplified code which demonstrates the problem and > the generated shapes: > <http://forum.openscad.org/file/n16584/involute-curve.png> > > I'm a noob with OpenSCAD so I'm probably doing something stupid. Thanks > for > any help! > > > > > > -- > View this message in context: > http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
N
Neon22
Sat, Mar 19, 2016 10:21 PM

So a suggested workaround is to upscale your scene by 100 or more.

--
View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16586.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

So a suggested workaround is to upscale your scene by 100 or more. -- View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16586.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DE
David Eccles (gringer)
Sun, Mar 20, 2016 8:52 AM

GooperMC wrote

I have a project where I am trying to model a involute curve.  I have a
function which returns a list of points where one of the parameters is how
many points it should return.

An involute curve with a specified number of points... that sounds familiar:

http://www.thingiverse.com/thing:195160

See the file 'gear_maker.scad'. I'm not convinced that I've got the involute
formula correct yet, but perhaps it might help you in working out how to do
this:

// note: pressure angle is not quite right. Max width is at a little bit
over 45 degrees

function involute(involute_angle) =
[(involute_anglecos(involute_angle)),
(involute_angle
sin(involute_angle))];

function involute0(d_y, add_frac, p_ang, involute_angle) =

[d_y*(involute_anglecos(involute_angle))/((45+p_ang)cos(45+p_ang)2sqrt(2)),
d_y
(((involute_angle
sin(involute_angle)<=(90*add_frac))?

involute_anglesin(involute_angle):(90add_frac))-((45+p_ang)*sin((45+p_ang))))/((45+p_ang)*cos(45+p_ang)2sqrt(2))];

function make_tooth(d_y, add_frac=0.90, p_ang=0.2, n_pts=30, res=[]) =
(len(res) > n_pts) ? res :
make_tooth(d_y=d_y,
add_frac=add_frac, p_ang=p_ang, n_pts=n_pts,
res=concat(res,[involute0(d_y=d_y,
add_frac=add_frac, p_ang=p_ang,
involute_angle=len(res)*180/n_pts-90)]));

...

myPath=make_tooth(20, add_frac=1, p_ang=0, n_pts=30);
polygon(points=myPath);

--
View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16590.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

GooperMC wrote > I have a project where I am trying to model a involute curve. I have a > function which returns a list of points where one of the parameters is how > many points it should return. An involute curve with a specified number of points... that sounds familiar: http://www.thingiverse.com/thing:195160 See the file 'gear_maker.scad'. I'm not convinced that I've got the involute formula correct yet, but perhaps it might help you in working out how to do this: // note: pressure angle is not quite right. Max width is at a little bit over 45 degrees function involute(involute_angle) = [(involute_angle*cos(involute_angle)), (involute_angle*sin(involute_angle))]; function involute0(d_y, add_frac, p_ang, involute_angle) = [d_y*(involute_angle*cos(involute_angle))/((45+p_ang)*cos(45+p_ang)*2*sqrt(2)), d_y*(((involute_angle*sin(involute_angle)<=(90*add_frac))? involute_angle*sin(involute_angle):(90*add_frac))-((45+p_ang)*sin((45+p_ang))))/((45+p_ang)*cos(45+p_ang)*2*sqrt(2))]; function make_tooth(d_y, add_frac=0.90, p_ang=0.2, n_pts=30, res=[]) = (len(res) > n_pts) ? res : make_tooth(d_y=d_y, add_frac=add_frac, p_ang=p_ang, n_pts=n_pts, res=concat(res,[involute0(d_y=d_y, add_frac=add_frac, p_ang=p_ang, involute_angle=len(res)*180/n_pts-90)])); ... myPath=make_tooth(20, add_frac=1, p_ang=0, n_pts=30); polygon(points=myPath); -- View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16590.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Sun, Mar 20, 2016 9:31 AM

Involute curves and gears:
I put quite some effort into a version for inkscape. Master repo is here:

One day I'll do a gearbox plugin that uses it.

--
View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16591.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Involute curves and gears: I put quite some effort into a version for inkscape. Master repo is here: - https://github.com/jnweiger/inkscape-gears-dev Maybe some of the math wil be useful to you. Good reference links too. One day I'll do a gearbox plugin that uses it. -- View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16591.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Sun, Mar 20, 2016 1:04 PM

There is an involute gear library included in the OpenSCAD distribution.

include <MCAD/involute_gears.scad>

Read the source code on your local hard drive for details.

On 20 March 2016 at 04:52, David Eccles (gringer) <
bioinformatics@gringene.org> wrote:

GooperMC wrote

I have a project where I am trying to model a involute curve.  I have a
function which returns a list of points where one of the parameters is

how

many points it should return.

An involute curve with a specified number of points... that sounds
familiar:

http://www.thingiverse.com/thing:195160

See the file 'gear_maker.scad'. I'm not convinced that I've got the
involute
formula correct yet, but perhaps it might help you in working out how to do
this:

// note: pressure angle is not quite right. Max width is at a little bit
over 45 degrees

function involute(involute_angle) =
[(involute_anglecos(involute_angle)),
(involute_angle
sin(involute_angle))];

function involute0(d_y, add_frac, p_ang, involute_angle) =

[d_y*(involute_anglecos(involute_angle))/((45+p_ang)cos(45+p_ang)2sqrt(2)),
d_y
(((involute_angle
sin(involute_angle)<=(90*add_frac))?

involute_anglesin(involute_angle):(90add_frac))-((45+p_ang)*sin((45+p_ang))))/((45+p_ang)*cos(45+p_ang)2sqrt(2))];

function make_tooth(d_y, add_frac=0.90, p_ang=0.2, n_pts=30, res=[]) =
(len(res) > n_pts) ? res :
make_tooth(d_y=d_y,
add_frac=add_frac, p_ang=p_ang, n_pts=n_pts,
res=concat(res,[involute0(d_y=d_y,
add_frac=add_frac, p_ang=p_ang,
involute_angle=len(res)*180/n_pts-90)]));

...

myPath=make_tooth(20, add_frac=1, p_ang=0, n_pts=30);
polygon(points=myPath);

--
View this message in context:
http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16590.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

There is an involute gear library included in the OpenSCAD distribution. include <MCAD/involute_gears.scad> Read the source code on your local hard drive for details. On 20 March 2016 at 04:52, David Eccles (gringer) < bioinformatics@gringene.org> wrote: > GooperMC wrote > > I have a project where I am trying to model a involute curve. I have a > > function which returns a list of points where one of the parameters is > how > > many points it should return. > > An involute curve with a specified number of points... that sounds > familiar: > > http://www.thingiverse.com/thing:195160 > > See the file 'gear_maker.scad'. I'm not convinced that I've got the > involute > formula correct yet, but perhaps it might help you in working out how to do > this: > > // note: pressure angle is not quite right. Max width is at a little bit > over 45 degrees > > function involute(involute_angle) = > [(involute_angle*cos(involute_angle)), > (involute_angle*sin(involute_angle))]; > > function involute0(d_y, add_frac, p_ang, involute_angle) = > > > [d_y*(involute_angle*cos(involute_angle))/((45+p_ang)*cos(45+p_ang)*2*sqrt(2)), > d_y*(((involute_angle*sin(involute_angle)<=(90*add_frac))? > > > involute_angle*sin(involute_angle):(90*add_frac))-((45+p_ang)*sin((45+p_ang))))/((45+p_ang)*cos(45+p_ang)*2*sqrt(2))]; > > function make_tooth(d_y, add_frac=0.90, p_ang=0.2, n_pts=30, res=[]) = > (len(res) > n_pts) ? res : > make_tooth(d_y=d_y, > add_frac=add_frac, p_ang=p_ang, n_pts=n_pts, > res=concat(res,[involute0(d_y=d_y, > add_frac=add_frac, p_ang=p_ang, > involute_angle=len(res)*180/n_pts-90)])); > > ... > > myPath=make_tooth(20, add_frac=1, p_ang=0, n_pts=30); > polygon(points=myPath); > > > > > -- > View this message in context: > http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16590.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
G
GooperMC
Tue, Mar 22, 2016 3:21 AM

Scaling up then down worked!  Thanks for the help.

--
View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16648.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Scaling up then down worked! Thanks for the help. -- View this message in context: http://forum.openscad.org/Passing-lots-of-points-to-polygon-results-in-lower-resolution-tp16584p16648.html Sent from the OpenSCAD mailing list archive at Nabble.com.