|
![](/i/fill.gif) |
clipka schreef:
> Am 14.04.2010 11:18, schrieb JWV:
>
>> As a reult, i now have a macro that makes a beveled shape, following a
>> path defined by a spline. This way one could make letters (anyone has a
>> libray of splines that are shaped like letters?).
>
> How did you do this?
I make a mesh that follows the spline, capping the ends with a cylinder
and a cone. The code is still a bit messy, but here it is:
#macro bevel_spline(S1,dd,eps,w,w2,H1, H2)
#union{
#mesh{
#declare ctr = 0;
#while (ctr < 1-(dd))
#local dy = S1(ctr+eps).z-S1(ctr).z;
#local dx = S1(ctr+eps).x-S1(ctr).x;
#local ds = sqrt(dy*dy+dx*dx);
#local vt1 = < -dy/ds,0, dx/ds>*sqrt(pow(dx/ds,2)+pow(dy/ds,2));
#local dy = S1(ctr+dd+eps).z-S1(ctr+dd).z;
#local dx = S1(ctr+dd+eps).x-S1(ctr+dd).x;
#local ds = sqrt(dy*dy+dx*dx);
#local vt2 = < -dy/ds,0, dx/ds>*sqrt(pow(dx/ds,2)+pow(dy/ds,2));
#local P1 = S1(ctr)+w*vt1;
#local P2 = S1(ctr)-w*vt1;
#local P3 = S1(ctr)+(w+w2)*vt1-H1*y;
#local P4 = S1(ctr)-(w+w2)*vt1-H1*y;
#local P5 = P3-H2*y;
#local P6 = P4-H2*y;
#local P1_ = S1(ctr+dd)+w*vt2;
#local P2_ = S1(ctr+dd)-w*vt2;
#local P3_ = S1(ctr+dd)+(w+w2)*vt2-H1*y;
#local P4_ = S1(ctr+dd)-(w+w2)*vt2-H1*y;
#local P5_ = P3_-H2*y;
#local P6_ = P4_-H2*y;
triangle{P1,P2,P2_ }
triangle{P1,P1_,P2_ }
triangle{P1,P1_,P3 }
triangle{P3_,P1_,P3 }
triangle{P2,P4,P4_ }
triangle{P2,P2_,P4_ }
triangle{P5,P3,P3_ }
triangle{P5,P5_,P3_ }
triangle{P6,P4,P4_ }
triangle{P6,P6_,P4_ }
triangle{P5,P6,P6_ }
triangle{P5,P5_,P6_ }
#declare ctr = ctr + dd;
#end
}
cone{ S1(0)-H1*y,(w+w2),S1(0),(w)}
cone{ S1(0)-H1*y,(w+w2),S1(0)-(H1+H2)*y,(w+w2)}
cone{ S1(1)-H1*y,(w+w2),S1(1),(w)}
cone{ S1(1)-H1*y,(w+w2),S1(1)-(H1+H2)*y,(w+w2)}
translate H1+H2*y
}
#end
object{bevel_spline(S1, 0.001, 0.00002, 0.075, 0.025, 0.05, 0.15)
pigment{Red} finish { diffuse 1 ambient 0 } }
Post a reply to this message
|
![](/i/fill.gif) |