discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Strange error message

Z
zapta
Mon, May 22, 2017 11:11 PM

The code below is a reduction of a larger program that still preserves the
error. If I compile it I get the following error:

Compiling design (CSG Tree generation)...
ERROR: Recursion detected calling function 'sqrt'
Rendering Polygon Mesh using CGAL...
WARNING: No top level geometry to render

If I change the 90 or 4 in the first line to any other number (e.g. 80/5) it
does work as expected and prints the "ww" echo.

I am using OpenSCAD version 2015.03-3 on Max OSX 10.12.4.

Anybody else can reproduce it?

Thanks

--

===========

slices = max(10, 90/4);  // changing the 90 or 4 'fixes' the problem
height = 100;
d1 = 21;
d2 = 30;
dr = (d2-d1)/2;
R = (drdr + heightheight/4) / (2 * dr);

function radius_at_height(h) =
let (dz = (h - height/2))
(d2/2 - (R - sqrt(RR - dzdz)));

function contour_points(extra_r, i=0) =
let(h = i * height / slices)
let(r = radius_at_height(h) + extra_r)
(i == slices)
?  [[r, h]]
:  concat([[r, h]], contour_points(extra_r, i+1));

echo("ww", contour_points(0));

--
View this message in context: http://forum.openscad.org/Strange-error-message-tp21566.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The code below is a reduction of a larger program that still preserves the error. If I compile it I get the following error: Compiling design (CSG Tree generation)... ERROR: Recursion detected calling function 'sqrt' Rendering Polygon Mesh using CGAL... WARNING: No top level geometry to render If I change the 90 or 4 in the first line to any other number (e.g. 80/5) it does work as expected and prints the "ww" echo. I am using OpenSCAD version 2015.03-3 on Max OSX 10.12.4. Anybody else can reproduce it? Thanks -- =========== slices = max(10, 90/4); // changing the 90 or 4 'fixes' the problem height = 100; d1 = 21; d2 = 30; dr = (d2-d1)/2; R = (dr*dr + height*height/4) / (2 * dr); function radius_at_height(h) = let (dz = (h - height/2)) (d2/2 - (R - sqrt(R*R - dz*dz))); function contour_points(extra_r, i=0) = let(h = i * height / slices) let(r = radius_at_height(h) + extra_r) (i == slices) ? [[r, h]] : concat([[r, h]], contour_points(extra_r, i+1)); echo("ww", contour_points(0)); -- View this message in context: http://forum.openscad.org/Strange-error-message-tp21566.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Mon, May 22, 2017 11:24 PM

Because 90/4 is not an integer, so you compare slices==i (an integer) it wont
match.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21567.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Because 90/4 is not an integer, so you compare slices==i (an integer) it wont match. ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21567.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Mon, May 22, 2017 11:25 PM

Did I get a face palm???


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21568.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Did I get a face palm??? ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21568.html Sent from the OpenSCAD mailing list archive at Nabble.com.
Z
zapta
Mon, May 22, 2017 11:59 PM

Yes, that's it. Thanks Michael.

BTW, sqrt is not recursive. I presume this is where it hit the stack limit.
A clearer message would be to report the deepest method in the stack that
has reoccurring appearances.

--
View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21569.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Yes, that's it. Thanks Michael. BTW, sqrt is not recursive. I presume this is where it hit the stack limit. A clearer message would be to report the deepest method in the stack that has reoccurring appearances. -- View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21569.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Tue, May 23, 2017 2:50 AM

The error showed 'radius_at_height' for me.
I don't know how easy it would be to examine the stack.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21570.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The error showed 'radius_at_height' for me. I don't know how easy it would be to examine the stack. ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Strange-error-message-tp21566p21570.html Sent from the OpenSCAD mailing list archive at Nabble.com.