|
|
//Creates a cone from p1 to p2 with radii r1 and r2 and rounds edges by
r3
#macro roundcone(p1,r1,p2,r2,r3)
#local H=sqrt(pow(p1.x-p2.x,2)+pow(p1.y-p2.y,2)+pow(p1.z-p2.z,2));
#local a=atan2(H,r1-r2);
merge {
torus { r1-tan(.5*pi-.5*a)*r3,r3 translate r3*y }
torus { r2-tan(.5*a)*r3,r3 translate (H-r3)*y }
cone { <0,0,0>,r1-tan(.5*pi-.5*a)*r3 <0,H,0>,r2-tan(.5*a)*r3 }
cone { <0,r3+sin(.5*pi-a)*r3,0>,r1-tan(.5*pi-.5*a)*r3+cos(.5*pi-a)*r3
<0,H-r3+sin(.5*pi-a)*r3,0>,r2-tan(.5*a)*r3+cos(.5*pi-a)*r3 }
rotate 90*x
PointTo(p2-p1)
translate p1
}
#end
Post a reply to this message
|
|