|
|
Both Point_At_Trans and Reorient_Trans are ill fitted to this task. They
don't look at the context and it can be matematically proven that there will
always exist some bend that will create a severe twist, using either macro.
Instead, each iteration along the spline must look at the orientation of the
previous iteration and make the aligment in the new iteration as close as
possible to the previous one. Only this way can you be sure that you'll
never get any ugly twists. Have a look at the code below.
#declare sp=spline{
natural_spline
-0.5, <0,-1,2>,
0.0, <-1,-1,1.5>,
0.25, <-1,0,1>,
0.5, <0,.75,0>,
0.75, <1,0,-1>,
1.0, <1,-1,-1.5>,
1.5, <0,-1,-2>
}
#declare incre = 1/20;
#declare rv = 360/12;
#declare Tang = sp(-incre/2)-sp(incre/2);
#declare Norm = VPerp_Adjust(x,Tang);
union{
#declare V=0;
#while(V<1-incre)
#declare R=0;
#declare TangNew = sp(V+incre/2)-sp(V+incre+incre/2);
#declare NormNew = VPerp_Adjust(Norm,TangNew);
#while(R<360)
#declare p1 = vaxis_rotate(Norm*0.3,Tang,(R-rv/2))+sp(V);
#declare p2 = vaxis_rotate(Norm*0.3,Tang,(R+rv/2))+sp(V);
#declare p3 = vaxis_rotate(NormNew*0.3,TangNew,(R-rv/2))+sp(V+incre);
#declare p4 = vaxis_rotate(NormNew*0.3,TangNew,(R+rv/2))+sp(V+incre);
triangle{p1,p2,p3}
triangle{p2,p3,p4}
#declare R=R+rv;
#end
#declare Tang = TangNew;
#declare Norm = NormNew;
#declare V = V+incre;
#end
pigment{rgb<0,.5,.25> }
finish{ambient 0.5 specular 1 roughness .0125 reflection{0,1 falloff 3}}
}
Rune
--
http://runevision.com
Post a reply to this message
|
|