|
![](/i/fill.gif) |
Wasn't it Hughes, B. who wrote:
>sphere_sweep doesn't seem to accept all the points given it by #while loop,
>from what I've found. Take the following script as an example:
>
>#declare SpaceTime=
>spline {
> linear_spline
> 0.0, <-50, 0, 0>,
> 0.1, <-50, 0, -20>,
> 0.2, <-20, 0, -20>,
> 0.3, <-20, 0, 0>,
> 0.4, <0, 0, 0>,
> 0.5, <30, 0, 0>,
> 0.6, <30, 0, 10>,
> 0.7, <40, 0, 10>,
> 0.8, <40, 0, 20>,
> 0.9, <80, 0, 20>,
> 1.0, <80, 0, 20>
>}
>
>#macro SphereSweep(P,F)
>#local Frame=frame_number+F;
> linear_spline
> Frame,
> SpaceTime(0),1
> #while (P<Frame)
> SpaceTime(clock),1
> #local P=P+1;
> #end
>#end
>
>sphere_sweep {
> SphereSweep(1,2)
>
>pigment {color rgb 1}
>}
>
>What happens is that only the first and then last point, produced in the
>loop, is actually plotted leaving the others out. Makes a single line
>without any corners, such as were planned in the SpaceTime() spline.
What happens there is that "clock" takes one value in any one frame. So,
for any one frame, SpaceTime(clock) is always the same point.
I think you want something more like this:
// MySphereSweep
// Start and End take values in range 0.0 - 1.0
#macro MySphereSweep(Start,End,TotalPoints)
#local Points=int((End-Start)*TotalPoints);
#if (Points>1)
#local N=0;
linear_spline
Points,
#while (N<Points)
#local P= Start+N/TotalPoints;
SpaceTime(P),1
#local N=N+1;
#end
#else
linear_spline 2,0,0,0,0
#end
#end
sphere_sweep {
MySphereSweep(0.0,clock,20)
pigment {color rgb 1}
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |