Hello!
on the path to more complexity i hit another wall:
in roundPoint i can't add the test? it gives me a syntax error in front of
the for loop?
and the main problem, i can't feed this to a polygon, each function adds a
nesting to the produced array, how do i avoid this?
my son had the ... delightful.... idea of drawing a dragon, so i started on
something to build the beak of it... i begun to draw the rough shape , and
once having that shape i wanted to smooth it out, but it didn't work as i
supposed it would...
thanks for any help!
Bruno
echo("poly", kieferPoly(b =40,l = 70,lw=10, d=2)) ;
function baseForm(x, b, l) = (b!= 0)? 4l/(bb) xx - l:0;
function curveAngle(l, y0, ueber, lw,hprim) = (l+y0 <= ueber)? 105-2*lw -
atan((ueber -y0)/hprim):(y0 == 0)? 0:-atan(y0/hprim);
function roundPoint(pt,rad, res = 3,above = true) =
[
//(above == true)?
for(n = [0:1:res])
let (w = 180 + 180/resn)
[pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
// :
// for(n = [0:1:res])
// let (w = 180/resn)
// [pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
];
function transvCut(x,y,z,d=1,res=3) =
[
roundPoint([x,y,z],d,res),
roundPoint([0,y,z+x],d,res, above = 0),
roundPoint([-x,y,z],d,res)
];
function kieferPoly(b,l,lw=10, d=2) =
let(curve = sqrt(ll+ bb/4))
let(hprim = curvecos(lw))
let( ueber = curvesin(lw))
[
for(x = [-b/2: 1 : 0])
let(y0 = baseForm(x,b,l))
let(beta = curveAngle(l, y0, ueber, lw,hprim))
transvCut(x,y0,curve*cos(beta)-hprim,d),
];
--
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
Yes, the list comprehension is not a general expression.
I'm not sure it's possible to change that.
Both branches look the same anyway, so I'd use
w = 180/res*n + above ? 180 : 0
As for nesting, check this post:
http://forum.openscad.org/2D-SVG-concat-points-point-no-output-loops-amp-conditionals-vector-declarations-td29068.html#a29070
You can drop one nesting level using 'each'
For some extra ideas for drawing using math, check
out https://www.desmos.com/art
ciao,
Torsten.
You can't use a a?b:c conditional within a list comprehension. You must use if (a) b else c instead.
Try replacing the list comprehension with this:
[
if (above == true)
for(n = [0:1:res])
let (w = 180 + 180/resn)
[pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
else
for(n = [0:1:res])
let (w = 180/resn)
[pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
];
Doug Moen.
thanks , that worked indeed!
Am Do., 21. Mai 2020 um 22:51 Uhr schrieb Doug Moen doug@moens.org:
You can't use a a?b:c conditional within a list comprehension. You must
use if (a) b else c instead.
Try replacing the list comprehension with this:
[
if (above == true)
for(n = [0:1:res])
let (w = 180 + 180/resn)
[pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
else
for(n = [0:1:res])
let (w = 180/resn)
[pt[0]+radcos(w),pt[1], pt[2]+radsin(w)]
];
Doug Moen.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr
great! each solved the stuff!
thanks!
Am Do., 21. Mai 2020 um 20:56 Uhr schrieb Torsten Paul <Torsten.Paul@gmx.de
:
Yes, the list comprehension is not a general expression.
I'm not sure it's possible to change that.
Both branches look the same anyway, so I'd use
w = 180/res*n + above ? 180 : 0
As for nesting, check this post:
You can drop one nesting level using 'each'
For some extra ideas for drawing using math, check
out https://www.desmos.com/art
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
ciao
Bruno
---==========
http://nohkumado.eu/, http://bboett.free.frhttp://aikido.nohkumado.eu/,
http://bboett.free.fr
http://aikido.zorn.free.fr