Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use <../iaito/naca/files/Naca_sweep.scad>
- kieferDraw(b =40,l = 70,lw=10, d=2);
- translate([0,00,5])rotate([0,180,0])kieferDraw(b =50,l = 70,lw=10, d=2);
- function baseForm(x, b, l) = (b!= 0)? 4*l/(b*b) *x*x - 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 roundPoint2D(pt,rad, res = 3,above = true, left = false) =
- [
- if(above == true)
- for(n = [((left)? res:0):((left)? -1:1):((left)? 0:res)])
- let (w = 180/res*n)
- [pt[0]+rad*cos(w), pt[1]+rad*sin(w)]
- else
- for(n = [((!left)? res:0):((!left)? -1:1):((!left)? 0:res)])
- let (w = 180+180/res*n)
- [pt[0]+rad*cos(w), pt[1]+rad*sin(w)]
- ];
- function transvCut2D(x,z,d=1,res=8) =
- [
- [0,z+x+d],
- each(roundPoint2D([-x,z],d,res = res, left=true, above=true)),
- each(roundPoint2D([0,z+x],d,res =res, left=false,above = false)),
- each(roundPoint2D([x,z],d,res, left=true,above = true))
- ];
- function trajectory(b,l,lw=10, d=2, curve)= // prepare data for sweep()
- [
- //let(curve = sqrt(l*l+ b*b/4)) //fail?? i can't use sqrt in func??
- let(hprim = curve*cos(lw))
- let(ueber = curve*sin(lw))
- for (x = [-b/2: 1 : 0])
- let(y0 = baseForm(x,b,l))
- let(beta = curveAngle(l, y0, ueber, lw,hprim))
- T_(0, y0, 0,
- Rx_(90,
- vec3D(
- transvCut2D(x,curve*cos(beta)-hprim,d)
- ))
- )
- ];
- module kieferDraw(b,l,lw=10, d=2)
- {
- curve = sqrt(l*l+ b*b/4);
- hprim = curve*cos(lw);
- ueber = curve*sin(lw);
- sweep(trajectory(b,l,lw, d,curve)); //
- //for(x = [-b/2: 1 : 0])
- //{
- // y0 = baseForm(x,b,l);
- // beta = curveAngle(l, y0, ueber, lw,hprim);
- // data = transvCut2D(x,curve*cos(beta)-hprim,d);
- // echo("data ",data);
- // translate([0,y0,0]) rotate([90,0,0])polygon(data);
- //}
- }
- function roundPoint(pt,rad, res = 3,above = true, left = false) =
- [
- //(above == true)?
- for(n = [((left)? res:0):((left)? -1:1):((left)? 0:res)])
- let (w = ((above)?0:180) + 180/res*n)
- [pt[0]+rad*cos(w),pt[1], pt[2]+rad*sin(w)]
- // :
- // for(n = [0:1:res])
- // let (w = 180/res*n)
- // [pt[0]+rad*cos(w),pt[1], pt[2]+rad*sin(w)]
- ];
- function transvCut(x,y,z,d=1,res=3) =
- [
- each(roundPoint([-x,y,z],d,res)),
- each(roundPoint([0,y,z+x],d,res, above = 0)),
- each(roundPoint([x,y,z],d,res))
- ];
- function kieferPoly(b,l,lw=10, d=2) =
- let(curve = sqrt(l*l+ b*b/4))
- let(hprim = curve*cos(lw))
- let( ueber = curve*sin(lw))
- [
- for(x = [-b/2: 1 : 0])
- let(y0 = baseForm(x,b,l))
- let(beta = curveAngle(l, y0, ueber, lw,hprim))
- each(transvCut(x,y0,curve*cos(beta)-hprim,d)),
- ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement