POV-Ray : Newsgroups : povray.general : Parsing a data set Server Time
17 Nov 2024 11:10:45 EST (-0500)
  Parsing a data set (Message 1 to 9 of 9)  
From: oliWood
Subject: Parsing a data set
Date: 29 Mar 2003 11:45:19
Message: <web.3e85cca8c6bb32750ee32b10@news.povray.org>
Hey Everybody,
It's been about 3 years since I did any major POV'ing but I need to make
some quick, yet impressive, 3d images to go in my dissertation (Simulating
flocks with boid technlogy) and POv sprang to mind.  However Im extreamly
rusty andthe last time I touched animations with POV was back on my 486
using Daves TGA Animator kit.

What I need to do is read in a set of position coordinates and orientations
for each scene for a fintie number of positions (of fish), either from a
single flat text file or one for each frame, render them and string them
together.

The modelling, rendering and stringing together I have sorted - but it's the
parsing of the file(s) holding the data im having trouble with - does
anybody know of a quick (eg. pre-existing ) external program to do it or
does somebody have some hand-rolled POV code to do such a thing ?

Thanks awfully,

oli (glad to be back)

oliver (at - spammers evil software begone - )coldclimate.co.uk


Post a reply to this message

From: Gwen & Emory Stagmer
Subject: Re: Parsing a data set
Date: 29 Mar 2003 11:53:39
Message: <3E85CE85.FB520F2F@comcast.net>
Oli,
   Check my hermite curve generator.  The input files are simple to create
from 3-d coords.
http://www.geocities.com/emory_stagmer/povherm

It makes in-betweening simple.  The object pass through the control points,
you specify how many frames to the next control point, and the curve is a 
smoothing function between them.  
At every control point is a vector to which the curve is tangent both into
and out of the control point (piece-wise smooth).

There's example POV source there too...should work great for a Boids sim...

Emory

oliWood wrote:
> 
> Hey Everybody,
> It's been about 3 years since I did any major POV'ing but I need to make
> some quick, yet impressive, 3d images to go in my dissertation (Simulating
> flocks with boid technlogy) and POv sprang to mind.  However Im extreamly
> rusty andthe last time I touched animations with POV was back on my 486
> using Daves TGA Animator kit.
> 
> What I need to do is read in a set of position coordinates and orientations
> for each scene for a fintie number of positions (of fish), either from a
> single flat text file or one for each frame, render them and string them
> together.
> 
> The modelling, rendering and stringing together I have sorted - but it's the
> parsing of the file(s) holding the data im having trouble with - does
> anybody know of a quick (eg. pre-existing ) external program to do it or
> does somebody have some hand-rolled POV code to do such a thing ?
> 
> Thanks awfully,
> 
> oli (glad to be back)
> 
> oliver (at - spammers evil software begone - )coldclimate.co.uk


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Parsing a data set
Date: 29 Mar 2003 12:35:11
Message: <3e85d94f@news.povray.org>
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.

--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> Hey Everybody,
> It's been about 3 years since I did any major POV'ing but I need to make
> some quick, yet impressive, 3d images to go in my dissertation (Simulating
> flocks with boid technlogy) and POv sprang to mind.  However Im extreamly
> rusty andthe last time I touched animations with POV was back on my 486
> using Daves TGA Animator kit.
>
> What I need to do is read in a set of position coordinates and
orientations
> for each scene for a fintie number of positions (of fish), either from a
> single flat text file or one for each frame, render them and string them
> together.
>
> The modelling, rendering and stringing together I have sorted - but it's
the
> parsing of the file(s) holding the data im having trouble with - does
> anybody know of a quick (eg. pre-existing ) external program to do it or
> does somebody have some hand-rolled POV code to do such a thing ?
>
> Thanks awfully,
>
> oli (glad to be back)
>
> oliver (at - spammers evil software begone - )coldclimate.co.uk
>


Post a reply to this message

From: oliWood
Subject: Re: Parsing a data set
Date: 29 Mar 2003 14:20:17
Message: <web.3e85f1cceb11af84b0be54280@news.povray.org>
Tim Nikias v2.0 wrote:
>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

From: ingo
Subject: Re: Parsing a data set
Date: 29 Mar 2003 15:02:20
Message: <Xns934DD66ED309Cseed7@povray.org>
in news:web.3e85cca8c6bb32750ee32b10@news.povray.org oliWood wrote:

> What I need to do is read in a set of position coordinates and
> orientations for each scene for a fintie number of positions (of
> fish), either from a single flat text file or one for each frame,
> render them and string them together.
> 

Read "6.2.3  File I/O Directives" from the docs.

You'll have to put your data comma sepparated in your text file.

Ingo


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Parsing a data set
Date: 29 Mar 2003 17:33:33
Message: <3e861f3d@news.povray.org>
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

From: oliWood
Subject: Re: Parsing a data set
Date: 29 Mar 2003 20:10:03
Message: <web.3e864229eb11af8459ddf11d0@news.povray.org>
Tim Nikias v2.0 wrote:
>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


And that will do the job nicely !
Thanks for getting me started - I should have been more organised, but the
deadline is running up close - will posta finished animation as soon as i
have one.

Thanks once again,

oli


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Parsing a data set
Date: 30 Mar 2003 05:24:34
Message: <3e86c5e2@news.povray.org>
I'll wait and see what the animation looks like. You
might want to consider releasing the code to the
POV-public? :-)


--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> Tim Nikias v2.0 wrote:
> >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
>
>
> And that will do the job nicely !
> Thanks for getting me started - I should have been more organised, but the
> deadline is running up close - will posta finished animation as soon as i
> have one.
>
> Thanks once again,
>
> oli
>


Post a reply to this message

From: Mark Weyer
Subject: Re: Parsing a data set
Date: 31 Mar 2003 04:03:33
Message: <3E87F996.8060002@informatik.uni-freiburg.de>
> Im using a Java program to generate my data, and thus can easily alter
> how/what im outputting.

Then output a .pov or .inc file.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

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