|
|
Tor Olav Kristensen wrote:
> Shurakai wrote:
>
>> Hi everybody,
>>
>> i tried to create a perfect circle using the spline function. But
>> somehow i
>> wasn't able to create a real circle. The problem is i can't use Chris
>> Colefax's spline macro, because it's not working with my PovRay. Always
>> produces a fatal error ??!! The prob is i need the circle defined by a
>> spline otherwise my animation debug macro will show no path for the
>> camera.
>> Anyway is there a trick ?? I tried cubic, quadratic and natural splines,
>> but no chance, never a real circle. The spline looks always a bit weird.
>> not perfectly round. And the camera moves near and far from the focused
>> object, when going around on the spline.
>> Then i tried to create a spiral, but there i have the same problem.
>> Please if someone knows a solution, i would be happy to know it also :).
>
>
> I recommend that you read a little about Rational B-Splines.
It is also possible to define circle and spiral movements
with simple trigonometric expressions in some functions:
#declare X_Fn = function(R, A) { R*cos(A) }
#declare Z_Fn = function(R, A) { R*sin(A) }
#declare Steps = 50;
#declare Radius = 10;
union {
#declare Cnt = 0;
#while (Cnt < Steps)
#declare Angle = radians(Cnt/Steps*360);
#declare pPos = <X_Fn(Radius, Angle), 0, Z_Fn(Radius, Angle)>;
sphere { pPos, 0.1 }
#declare Cnt = Cnt + 1;
#end // while
texture ...
}
To get a spiral with an increasing radius:
#declare RR = Cnt/Steps*Radius;
#declare pPos = <X_Fn(RR, Angle), 0, Z_Fn(RR, Angle)>;
Another kind of spiral:
#declare Height = 8;
#declare Y_Fn = function(T) { (T/Steps - 0.5)*Height }
...
#declare pPos = <X_Fn(Radius, Angle), Y_Fn(Cnt), Z_Fn(Radius, Angle)>;
Note that all this is untested code.
--
Tor Olav
http://subcube.net
http://subcube.com
Post a reply to this message
|
|