POV-Ray : Newsgroups : povray.advanced-users : Clock Problem (or question) Server Time
2 Nov 2024 05:22:13 EDT (-0400)
  Clock Problem (or question) (Message 1 to 9 of 9)  
From: H  E  Day
Subject: Clock Problem (or question)
Date: 20 Jul 2000 12:20:39
Message: <01bff266$90020260$537889d0@daysix>
Is there any way to grab the clock value in a specific frame and make it a
perminent value?  In other words, get the current clock value and make it
into a declared value that doesn't change over the rest of the animation?  
I really need help with this one, folks.
TIA.

-- 
H.E. Day
<><


Post a reply to this message

From: Warp
Subject: Re: Clock Problem (or question)
Date: 20 Jul 2000 12:32:23
Message: <39772997@news.povray.org>
H. E. Day <Pov### [at] aolcom> wrote:
: Is there any way to grab the clock value in a specific frame and make it a
: perminent value?  In other words, get the current clock value and make it
: into a declared value that doesn't change over the rest of the animation?  
: I really need help with this one, folks.

  If you are using the official povray you can #write the value into a file
and #read that value from the file in the next frames.
  For all the frames previous to this event you can have, for example, an
"illegal" value in the file which is ignored (like -1 or something).

  If you are using megapov, you can use persistent variables.

-- 
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

From: Vahur Krouverk
Subject: Re: Clock Problem (or question)
Date: 20 Jul 2000 12:37:09
Message: <39772AC5.9020A48B@aetec.ee>
"H. E. Day" wrote:
> 
> Is there any way to grab the clock value in a specific frame and make it a
> perminent value?  In other words, get the current clock value and make it
> into a declared value that doesn't change over the rest of the animation?
> I really need help with this one, folks.
> TIA.
> 
> --
> H.E. Day
> <><
Easier would be to use some other variable instead of clock: if clock is
smaller from given value, then make it equal to clock, otherwise set to
some fixed value. Or am I missing something?


Post a reply to this message

From: Darcy Johnston
Subject: Re: Clock Problem (or question)
Date: 22 Jul 2000 00:07:38
Message: <39791e0a@news.povray.org>
"H. E. Day" <Pov### [at] aolcom> wrote in message
news:01bff266$90020260$537889d0@daysix...
> Is there any way to grab the clock value in a specific frame and make it a
> perminent value?  In other words, get the current clock value and make it
> into a declared value that doesn't change over the rest of the animation?
> I really need help with this one, folks.

If you know how to decide when you want this clock value, then perhaps you
can just calculate it ahead of time based on what the final clock value will
be? Or are you trying to create an array with off of the values used for
clock? Maybe a better picture of how/when you'll use the value will help us
understand exactly what we have to work with...

Darcy


Post a reply to this message

From: Bob Hughes
Subject: Re: Clock Problem (or question)
Date: 22 Jul 2000 15:14:07
Message: <3979f27f@news.povray.org>
"H. E. Day" <Pov### [at] aolcom> wrote in message
news:01bff266$90020260$537889d0@daysix...
| Is there any way to grab the clock value in a specific frame and make it a
| perminent value?  In other words, get the current clock value and make it
| into a declared value that doesn't change over the rest of the animation?

Maybe making the clock be a frame count instead of 0 to 1 and then divide by
total frames would be best:

INI file:
Initial_Clock=1
Final_Clock=100

POV file:
#declare Clock=clock/TotalFrames;
#declare TotalFrames=100;
#declare CheckFrame=50;

#if (clock>=CheckFrame) // from CheckFrame number onward
 #declare SavedClock=CheckFrame/TotalFrames; // this is seen
#end

Using Clock in place of 'clock' everyplace you would be using it besides.
'clock' will be a count then from first frame to last, and SavedClock is
your kept variable.  Not sure why anyone else including you wasn't thinking
of it this way.  Too simplistic perhaps?

Bob


Post a reply to this message

From: H  E  Day
Subject: Re: Clock Problem (or question)
Date: 23 Jul 2000 00:46:35
Message: <01bff461$06c8ef20$397889d0@daysix>
Ok, here's what I have. 
I've got a spline{} declared.  When the (say I'm only using the x variable)
value of this spline is over one I want to: create a projectile, save the
current clock value, and use that saved value to achieve rotation and
translation based on two other splines. Then I want to move the projectile
along a straight path at a constant rate. 
I have no idea how to do this.

Does this explain what I need well enough?


Post a reply to this message

From: Rune
Subject: Re: Clock Problem (or question)
Date: 23 Jul 2000 10:43:23
Message: <397b048b@news.povray.org>
"H. E. Day" wrote:
> Ok, here's what I have.
> I've got a spline{} declared.  When the (say I'm only using the x
variable)
> value of this spline is over one I want to: create a projectile, save the
> current clock value, and use that saved value to achieve rotation and
> translation based on two other splines. Then I want to move the projectile
> along a straight path at a constant rate.
> I have no idea how to do this.

// myclock will be equal to clock until myvalue gets above 1.
// At that point myclock will "freeze".

#if (myvalue>1)
   #fopen data "data.inc" write
      #write (data,"#declare myclock = ",clock,";\n")
   #fclose data
#end

#if (file_exists("data.inc")=1)
   #include "data.inc"
#else
   #declare myclock = clock;
#end

Is this what you need?

Rune
--
Updated July 10: http://rsj.mobilixnet.dk
3D images, include files, stereograms, tutorials,
The POV Desktop Theme, The POV-Ray Logo Contest,
music, 350+ raytracing jokes, and much more!


Post a reply to this message

From: John VanSickle
Subject: Re: Clock Problem (or question)
Date: 23 Jul 2000 14:19:52
Message: <397B3775.E161074F@erols.com>
"H. E. Day" wrote:
> 
> Ok, here's what I have.
> I've got a spline{} declared.  When the (say I'm only using the x
> variable) value of this spline is over one I want to: create a
> projectile, save the current clock value, and use that saved value to
> achieve rotation and translation based on two other splines. Then I
> want to move the projectile along a straight path at a constant rate.
> I have no idea how to do this.
> 
> Does this explain what I need well enough?

The way I go about doing this is to figure out what time the spline
reaches the point in question, and then use an #if-#else-#end block
to model the motion before and after this time.

It is highly likely that the precise time will fall at a period
between the time of two different frames; hence at the latter of the
two frames, some of the motion after the event will already have
occured.

Now this technique is more difficult (possibly way more difficult),
but kids your age have it so easy that a little hard thinking is
good for you :-)

Seriously, the resulting code will produce the same result for any
frame rate and will be more accurate in the modelling.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

From: Rune
Subject: Re: Clock Problem (or question)
Date: 23 Jul 2000 17:51:25
Message: <397b68dd@news.povray.org>
"John VanSickle" wrote:
> "H. E. Day" wrote:
> >
> > Ok, here's what I have.
> > I've got a spline{} declared.  When the (say I'm only using the x
> > variable) value of this spline is over one I want to: create a
> > projectile, save the current clock value, and use that saved value to
> > achieve rotation and translation based on two other splines. Then I
> > want to move the projectile along a straight path at a constant rate.
> > I have no idea how to do this.
> >
> > Does this explain what I need well enough?
>
> The way I go about doing this is to figure out what time the spline
> reaches the point in question, and then use an #if-#else-#end block
> to model the motion before and after this time.

If the animation is dependent on the clock value alone (which is most often
the case) I would say too that this is the best solution. Only if some
calculations are done on a frame-by-frame basis the method I posted is
necessary.

> It is highly likely that the precise time will fall at a period
> between the time of two different frames; hence at the latter of the
> two frames, some of the motion after the event will already have
> occured.

I presume that we want to find the first time the event occurs. Unless the
event is caused a whole lot of times during the animation, it should be
pretty easy to find the "first intersection".

Greetings,

Rune
--
Updated July 23: http://rsj.mobilixnet.dk
3D images, include files, stereograms, tutorials,
The POV Desktop Theme, The POV-Ray Logo Contest,
music, 350+ raytracing jokes, and much more!


Post a reply to this message

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