|
|
If you'd set your JAVA program to output like this:
Coordinate , Orientation, Coordinate, Orientation, ...,
if you know the amount of boids, and if you make sure
that there's always a comma after every coordinate
or orientation (even after the last one!), you could use
something like:
#declare Boid_Amount=0;
#declare _Counter=0;
#fopen _D Data_File read
//This jumps ahead to the needed frame
#while (_Counter<frame_number*Boid_Amount)
#read (_D,_Coord, _Orient)
#declare _Counter=_Counter+1;
#end
//This reads the required data
#while(defined(Data_File) & Boid<Boid_Amount)
#read (_D, _Coord, _Orient)
#declare Boid=Boid+1;
[... Do some stuff with _Coord and _Orient to place a boid ...]
#end
#fclose _D
This should work if frame_number begins with 1. The first
loop will read past the earlier frames, and the second will
read the necessary data. I can't test it without a file though,
so you might want to see frame_number needs to be
(frame_number +/- 1) and if it has to be Boid<=Boid_Amount
instead of just <.
--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde
> >I don't know what you're actually after here. Reading
> >the data? And can you modify the way in which the
> >data is written? If you're working from within POV with
> >POV-script, reading and writing could be done with
> >my IO-Macros, but aside of that, I don't know how I
> >could help.
>
>
> Sorry - I didnt make myself very clear (having read it back).
>
> Im using a Java program to generate my data, and thus can easily alter
> how/what im outputting.
> Basically at the minute im outputting a single long text file where each
row
> holds the x and y coords of a fish and it's orientation (rotated around
the
> Z axis - right-hand- coord sys).
> Between each of the "frames" of data theres a * e.g. theres a 100 lines of
> coords etc then a * and then another 100 lines.
>
> If i could read this file in with a bit of POV script and then use the
Clock
> to cycle through the datasets to place 100 fish for each frame that would
> be great. Failing that i can use Perl to split the file into a heap of
> seperate ones , eg. one for each frame, and then somehow read a different
> file in for frame of the animation (use the clock vlaue to pick a file
name
> possibly?)
>
> Hope that clears the fog,
>
> oli
>
Post a reply to this message
|
|