POV-Ray : Newsgroups : povray.newusers : Rollercoaster type maths (not possible in povray?) : Re: Rollercoaster type maths (not possible in povray?) Server Time
29 Jul 2024 10:32:40 EDT (-0400)
  Re: Rollercoaster type maths (not possible in povray?)  
From: CdeathJd
Date: 2 Aug 2006 06:10:00
Message: <web.44d07985d4496aa8e2e0912a0@news.povray.org>
"Charles C" <nomail@nomail> wrote:
> Ok, for file writing in POV, try this to get you started....  Note that
> there should be a backslash in front of some of the n characters denoting a
> new line, but it doesn't make it into the newsgroup.   You'll have to fix
> that before this'll work.
>
> // ------------------------------------------
>
> #macro Save_Velocity()
>   #fopen IFV_File "InterFrameVelocity.inc" write
>   #write ( IFV_File, "// This is a generated file which " )
>   #write ( IFV_File, "can probably be deleted without too much harm.n" )
>   #write ( IFV_File, concat(  "#declare Velocity = <",
>                          vstr(3, Velocity, ",", 0,15),
>                          ">;n"
>                      )
>   )
>   #fclose IFV_File
> #end
>
> #declare Velocity = <1,0,0>;
>
> Save_Velocity()
>
> #undef Velocity
>
> #ifndef(Velocity)
>   #debug "nUh oh, Velocity is undefined.  Including InterFrameVelocity.incn"
>   #include "InterFrameVelocity.inc"
> #end
>
> #debug concat("nVelocity is <", vstr(3, Velocity, ",", 0,15), ">n" )
>
>
> // -----------------------------------------
>
>
> Note that vstr() is the vector version, but there's also str() to convert
> floats to strings.
>
> Charles
>
>
> "CdeathJd" <nomail@nomail> wrote:
> > As well as that, im now trying to go full-throttle and put velocity in. I
> > know the easiest way to do it, but i doubt pov-ray will like it, if i could
> > store velocity as a global variable this would be bliss.
> >
> > Unfortunately every variable has to be #declare'd. So each time it runs
> > through the scene it loses all the data from the last frame. I though about
> > outputting the velocity to a file and then reading it back in at the start
> > of the next frame. The pov-ray help file doesn't really explain anything
> > very well to me, so has anyone got any advice?

Cheers, thats really good, although i should maybe have looked around a bit
more. I'm stuck now anyways as i can find no way of finding out the
camera's y value, and quite frankly i've no idea how to make it work (as i
never manages this in normal programming either).


Post a reply to this message

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