Actually it is quite easy to implement functions with OpenSCAD in the desired
way. The trick is to recall what an integral is in the mathematical sense.
This solution works for most functions a designer would need and may easily
be adopted to create 3D surfaces with functions z = f(x,y). Just nest a
second loop and create polyhedrons.
Here is your UFO ...
rotate_extrude($fn = 100)
sine_fct();
module sine_fct(start=0, stop=360, steps=50)
{
dx = (stop-start)/steps;
for(x = [start:dx:stop-dx])
{
polygon(points = [
[ToRad(x), 0], [ToRad(x), sin(x)],
[ToRad(x+dx), sin(x+dx)], [ToRad(x+dx), 0],
]);
}
}
function ToRad(x) = x/180*PI;
--
View this message in context: http://forum.openscad.org/Computing-polygon-by-function-tp1432p10998.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Actually it is quite easy to implement functions with OpenSCAD in the desired
way. The trick is to recall what an integral is in the mathematical sense.
This solution works for most functions a designer would need and may easily
be adopted to create 3D surfaces with functions z = f(x,y). Just nest a
second loop and create polyhedrons.
Here is your UFO ...
rotate_extrude($fn = 100)
sine_fct();
module sine_fct(start=0, stop=360, steps=50)
{
dx = (stop-start)/steps;
for(x = [start:dx:stop-dx])
{
polygon(points = [
[ToRad(x), 0], [ToRad(x), sin(x)],
[ToRad(x+dx), sin(x+dx)], [ToRad(x+dx), 0],
]);
}
}
function ToRad(x) = x/180*PI;
--
View this message in context: http://forum.openscad.org/Computing-polygon-by-function-tp1432p10998.html
Sent from the OpenSCAD mailing list archive at Nabble.com.