POV-Ray : Newsgroups : povray.animations : Animating a circular path : Re: Animating a circular path Server Time
28 Jul 2024 16:32:38 EDT (-0400)
  Re: Animating a circular path  
From: Nieminen Juha
Date: 4 Oct 1999 06:30:32
Message: <37f881c8@news.povray.org>
Paul F <pau### [at] lineonenet> wrote:
: translate <sin((2*clock)*pi)*6, cos((2*clock)*pi)*6, 3>

  This _is_ the basic approach. (Of course you could use rotate, but then
it would rotate the object instead of just translating it.)

  The sin(a) function returns the y-coordinate of a unit vector which have
been rotated 'a' radians around the origin. Likewise the cos('a') function
returns the x-coordinate.
  One complete turn, ie. 320 degrees is 2*pi radians. This means that if
you want to turn the object a complete circle with the clock runnin from
0 to 1, you get the coordinates with <cos(2*pi*clock), sin(2*pi*clock), 0>.
This gives a circle of radius 1. Multiply it with the radius you want to
get the proper circle.

  Of you want to play with degrees instead of radians, there's a handy
radians() function in povray. We can write the above vector this way:

<cos(radians(320)*clock), sin(radians(320)*clock), 0>

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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