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:18:25 EDT (-0400)
  Re: Rollercoaster type maths (not possible in povray?)  
From: Charles C
Date: 2 Aug 2006 01:50:01
Message: <web.44d03b1bd4496aa8200a56120@news.povray.org>
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?


Post a reply to this message

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