POV-Ray : Newsgroups : povray.animations : Need help fast! : Re: Need help fast! Server Time
1 Jul 2024 05:12:33 EDT (-0400)
  Re: Need help fast!  
From: Borodog
Date: 25 Feb 2005 13:25:00
Message: <web.421f6cde2e505a1ca937fd00@news.povray.org>
Thank you, Mike. I eventually dug around enough in some example scene files
and the manual and came up with almost the same solution:

  #fopen Dataset "fort.23" read
  #declare Index = 1;
  #while(Index <= frame_number)
  #read (Dataset,Time,X_Pos,Y_Pos,Beta,Phi)
  #local Index = Index + 1;
  #end
  #fclose Dataset

But I really appreciate the response. The other part that was difficult was
getting it to actually animate, i.e. render more than one frame. This is
NOT adequately covered in the manual, in my humble opinion.

Thanks for your help,

Mike Owen

Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it Borodog who wrote:
> >Hi all. I haven't used POVRay in several years, and now I find myself in the
> >position of needing help fast.
> >
> >I teach physics at the North Carolina School of Science and Math, and have
> >some students working on a project concerning the physics of snowboarding.
> >They've created a model that simulates a downhill snowboard run, saving the
> >data in a plain text file containing x and y position, angle of attack of
> >the board, and direction of motion for successive timesteps.
> >
> >I've created a POVRay source file of a snowboarder on an incline, and know
> >how to modify the source file to rotate and translate the character.
> >However, I need to know how to take the data generated by the simulation
> >and somehow plug it into the POVRay scene file and make a series of
> >rendered images and stitch them together and make an animation.
> >
> >I did this sort of thing 5 or 6 years ago, but I was using an entirely
> >different platform, and it's been a long, long time. Can anyone give me the
> >quickest and dirtiest way to take our dataset and produce an animation?
> >Time is very short.
> >
> >For what it's worth, we're running on Windows XP.
> >
> >Thanks for any help you can provide.
>
> Convert your data to a format where the numbers are separated by commas,
> ensuring that there is a comma at the ends of the lines. (POV doesn't
> see the end of line characters, so it always needs the commas.)
>
> 1,2,3,0.5,
> 2,3,4,0.6,
> 3,4,5,0.7,
>
> Then use POV to read the data with #fopen and #read, like this
>
> #fopen DATA "data.txt" read     // open the file
> #declare F=0;                   // start a counter
> #while (F < frame_number)       // loop
>   #read (DATA, X,Y,Z,Angle)     // read a chunk of data
>   #declare F=F+1;               // increment counter
> #end
>
> POV restarts from the beginning of the file for each frame, so this code
> reads and ignore the entries that correspond to earlier frames.
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

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