POV-Ray : Newsgroups : povray.binaries.animations : circle or spiral by spline ?? Server Time
8 Jul 2024 08:01:54 EDT (-0400)
  circle or spiral by spline ?? (Message 1 to 3 of 3)  
From: Shurakai
Subject: circle or spiral by spline ??
Date: 14 Oct 2004 07:00:01
Message: <web.416e5bf8995f63ba6b3522e90@news.povray.org>
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 :).

Have fun, Shu.


Post a reply to this message


Attachments:
Download 'anim.mpg' (553 KB)

From: Tor Olav Kristensen
Subject: Re: circle or spiral by spline ??
Date: 14 Oct 2004 07:44:38
Message: <416e66a6$1@news.povray.org>
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.

-- 
Tor Olav
http://subcube.net
http://subcube.com


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: circle or spiral by spline ??
Date: 14 Oct 2004 08:17:17
Message: <416e6e4d$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.