POV-Ray : Newsgroups : povray.animations : Animating a circular path Server Time
24 Nov 2024 15:20:42 EST (-0500)
  Animating a circular path (Message 1 to 8 of 8)  
From: Paul F
Subject: Animating a circular path
Date: 2 Oct 1999 19:21:01
Message: <37f6935d@news.povray.org>
I have been animating an object so it will move in a circular path this is
the math
that i come up with through trial and error and it douse work! but to the
more experienced animator it is probely unconventional, and why i used pi i
dont know i just recall using something like this when i was writing basic
programs on the good old C64:
translate <sin((2*clock)*pi)*6, cos((2*clock)*pi)*6, 3>

what would be a more basic aproach to translating an object in a circle say
with a radius 5 units across any help would be greatly received please could
you post and mail me as i sometimes have trouble connecting to the news
server thanks

Paul


Post a reply to this message

From: Peter Popov
Subject: Re: Animating a circular path
Date: 2 Oct 1999 20:21:10
Message: <CaH2N8T4tXRUOFlmVkk8bb6UI7tP@4ax.com>
On Sun, 3 Oct 1999 00:22:38 +0100, "Paul F" <pau### [at] lineonenet>
wrote:

>what would be a more basic aproach to translating an object in a circle say
>with a radius 5 units across any help would be greatly received please could
>you post and mail me as i sometimes have trouble connecting to the news
>server thanks
>
>Paul

How about rotating it?

object 
{ MyObject // centered around the origin
  translate 5*x rotate 360*y*clock
}



Peter Popov
ICQ: 15002700


Post a reply to this message

From: Bob Hughes
Subject: Re: Animating a circular path
Date: 2 Oct 1999 22:46:44
Message: <37f6c394@news.povray.org>
Don't worry Paul, I was trying to do the same thing when I started out.
It's incredibly simple, as Peter has shown.

Bob

Peter Popov <pet### [at] usanet> wrote in message
news:CaH2N8T4tXRUOFlmVkk8bb6UI7tP@4ax.com...
> On Sun, 3 Oct 1999 00:22:38 +0100, "Paul F" <pau### [at] lineonenet>
> wrote:
>
> >what would be a more basic aproach to translating an object in a circle
say
> >with a radius 5 units across any help would be greatly received please
could
> >you post and mail me as i sometimes have trouble connecting to the news
> >server thanks
> >
> >Paul
>
> How about rotating it?
>
> object
> { MyObject // centered around the origin
>   translate 5*x rotate 360*y*clock
> }
>
>
>
> Peter Popov
> ICQ: 15002700


Post a reply to this message

From: Chris Huff
Subject: Re: Animating a circular path
Date: 3 Oct 1999 09:11:49
Message: <37F75683.2B2D6423@compuserve.com>
That won't work if you want all of the objects to be aligned, if that is
what he wants, this should work:
object  {MyObject // centered around the origin
    rotate -360*y*clock
    translate 5*x
    rotate 360*y*clock
}


Post a reply to this message

From: Spock
Subject: Re: Animating a circular path
Date: 3 Oct 1999 09:27:54
Message: <37f759da@news.povray.org>
Ok, I went through the same learning curve and came out with
the same answer, so here is an interesting follow-up question:

Can you tell me the formula for determining where in 3space I
am after this sort of translate/rotate action.  For example if I
wanted the camera to follow the rotating object (but not from
the origin :-) I need to "look_at" the <x,y,z> resulting from your
transformation.  Any ideas?

Peter Popov <pet### [at] usanet> wrote in message
news:CaH2N8T4tXRUOFlmVkk8bb6UI7tP@4ax.com...
> On Sun, 3 Oct 1999 00:22:38 +0100, "Paul F" <pau### [at] lineonenet>
> wrote:
>
> >what would be a more basic aproach to translating an object in a circle
say
> >with a radius 5 units across any help would be greatly received please
could
> >you post and mail me as i sometimes have trouble connecting to the news
> >server thanks
> >
> >Paul
>
> How about rotating it?
>
> object
> { MyObject // centered around the origin
>   translate 5*x rotate 360*y*clock
> }
>
>
>
> Peter Popov
> ICQ: 15002700


Post a reply to this message

From: Chris Huff
Subject: Re: Animating a circular path
Date: 3 Oct 1999 11:14:07
Message: <37F7732D.2BD7B22A@compuserve.com>
Translation is just addition of the two vectors, scaling is just
multiplication, and for rotation, there is the vrotate() function.


Post a reply to this message

From: Peter Popov
Subject: Re: Animating a circular path
Date: 3 Oct 1999 13:17:03
Message: <bY73N4gll6VUxwWCmoCpm15HVTGh@4ax.com>
On Sun, 3 Oct 1999 09:27:54 -0400, "Spock" <spo### [at] homecom> wrote:

>Ok, I went through the same learning curve and came out with
>the same answer, so here is an interesting follow-up question:
>
>Can you tell me the formula for determining where in 3space I
>am after this sort of translate/rotate action.  For example if I
>wanted the camera to follow the rotating object (but not from
>the origin :-) I need to "look_at" the <x,y,z> resulting from your
>transformation.  Any ideas?

Here's a example of what Chris explained:

sphere 
{ <4,1,2>, 1 
  translate <-1,4,2> 
  scale <2,1,2> 
  rotate <-30,0,-30>
}

The center of the sphere will end up at:
vrotate( (<4,1,2>+<-1,4,2>)*<2,1,2>, <-30,0,-30> )

Pay close attention to operator precedence!


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Nieminen Juha
Subject: Re: Animating a circular path
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.