Dear all,
I would like to make a threedimensional parametric plot of the form x = f(u,v) y = g(u,v) z = h(u,v) as a function of the two parameters u_min < u < u_max, v_min < v < v_max in Open SCAD. Do you know how to do this? Note that this is different from plotting a function of two variables, z = f(x,y), for which there are OpenSCAD libraries available, such as this one <https://www.thingiverse.com/thing:24897> . Thank you for your help. Best,  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Administrator

Reposting as it didn't make it to the mailinglist.
Aleandro wrote > Dear all, > I would like to make a threedimensional parametric plot of the form > > x = f(u,v) > y = g(u,v) > z = h(u,v) > > as a function of the two parameters u_min < u < u_max, v_min < v < v_max > in > Open SCAD. Do you know how to do this? > > Note that this is different from plotting a function of two variables, z = > f(x,y), for which there are OpenSCAD libraries available, such as this > one > <https://www.thingiverse.com/thing:24897> . > > Thank you for your help. > Best, > > > > >  > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  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!  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin  email* me if you need anything,
or if I've done something stupid... * click on my MichaelAtOz label, there is a link to email me. 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! 
In reply to this post by Aleandro
20180329 15:40 GMT+02:00 Aleandro <[hidden email]>: Dear all, Saludos,
Antonio _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
This is exactly what I was looking for, thank you. However, the file gives me
a compilation error, see the screenshot attached. Do you know why I get this error? Thanks <http://forum.openscad.org/file/t2203/Screen_Shot_20180329_at_6.png>  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I was under the impression you were looking for a parametric patch:
function f(x,y)=cos(x)*cos(y); function g(x,y)=cos(x)*sin(y); function h(x,y)=sin(x); xmin=45; xmax=45; xsteps=12; ymin=45; ymax=45; ysteps=12; xstep=(xmaxxmin)/(xsteps); ystep=(ymaxymin)/(ysteps); points=[ for(j=[0:xsteps]) for(i=[0:ysteps]) [ f(xmin+j*xstep,ymin+i*ystep), g(xmin+j*xstep,ymin+i*ystep), h(xmin+j*xstep,ymin+i*ystep) ] ]; faces=[ for(j=[0:xsteps1]) for (i=[0:ysteps1]) [ i +(ysteps+1) +j*(ysteps+1), i+1 +(ysteps+1) +j*(ysteps+1), i+1 +j*(ysteps+1), i +j*(ysteps+1) ] ] ; polyhedron( points=points, faces=faces );This doesn't produce a closed surface. Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Aleandro
It looks like the problem is the "else" in the list. I'm using the last snapshot version for Windows (2018.03.10) with all the experimental features enabled, in particular "lcelse", which allows the use of "else" in list comprehensions. If you can't/don't want to use this version or feature, try commenting out lines 45, 47, 48, 51, 53, and 54: // faces using those points lower_triangles = [ for (i = [1:x_steps], j = [1:y_steps]) //if (norm(points[i+(x_steps+1)*(j1)]points[i1+(x_steps+1)*j]) < norm(points[i1+(x_steps+1)*(j1)]points[i+(x_steps+1)*j])) [i1+(x_steps+1)*(j1), i+(x_steps+1)*(j1), i1+(x_steps+1)*j] //else // [i1+(x_steps+1)*(j1), i+(x_steps+1)*(j1), i+(x_steps+1)*j] // middle edge flipping ]; upper_triangles = [ for (i = [1:x_steps], j = [1:y_steps]) //if (norm(points[i+(x_steps+1)*(j1)]points[i1+(x_steps+1)*j]) < norm(points[i1+(x_steps+1)*(j1)]points[i+(x_steps+1)*j])) [i+(x_steps+1)*(j1), i+(x_steps+1)*j, i1+(x_steps+1)*j] //else // [i1+(x_steps+1)*(j1), i+(x_steps+1)*j, i1+(x_steps+1)*j] // middle edge flipping ]; triangles = concat(lower_triangles, upper_triangles); echo(str(len(triangles), " faces")); 20180329 18:47 GMT+02:00 Aleandro <[hidden email]>: This is exactly what I was looking for, thank you. However, the file gives me Saludos,
Antonio _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by NateTG
This works fine and compiles with no errors, than you.
 Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Edit this page 