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:28:42 EDT (-0400)
  Re: Rollercoaster type maths (not possible in povray?)  
From: Urs Holzer
Date: 4 Aug 2006 13:23:08
Message: <44d3827c@news.povray.org>
CdeathJd 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?

POV-Ray doesn't save variables between frames. Every frame is parsed for
itself.

If you use splines, you can calculate the velocity easely. In physics,
the velocity is defined as the derivative of the position. I guess
there is no simple way to compute the derivative of a spline in
POV-Ray. But there is an easy way to calculate it with a nummerical
method which is not exact, but exact enough.
Just evaluate the spline at two times. Once where you are in time now
and once a second later. This gives you the position you have now and
the position you will have a second later. If you substract these two
values you will have the velocity. (The velocity is a vector pointing
in the direction you move. His length is your speed.)

It seems you are making progress. I think the documentation of POV-Ray
is very good. Read in the documentation the parts that could help you
and try to understand them. Also try to understand the mathematic
behind the things. And look also at the tutorial in the documentation
which contains many examples.

A little Hint: If you want to move or rotate objects in a
coordinatesystem relative to them, try the following:
Do all transforms in reverse order.

Happy POV-Ray-coding!


Post a reply to this message

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