POV-Ray : Newsgroups : povray.animations : please help me with #read Server Time
17 May 2024 03:29:28 EDT (-0400)
  please help me with #read (Message 1 to 3 of 3)  
From: ferrari
Subject: please help me with #read
Date: 20 Jun 2006 13:25:00
Message: <web.44982dad700a8a942e10ed0e0@news.povray.org>
hello, I am using #fopen and (#read) to read data from a list of this form:

1;
0.4;
4;
2.34;
5.67;
2.11;
etc...

I need to assign each value for the next frame in an animation.

1;      for frame 1
0.4;    for frame 2
4;      for frame 3
2.34;   for frame 4
5.67;   for frame 5
2.11;   for frame 6.....etc...

I use this code:

#include "AutoClck.mcr"
#declare Dur=3000;
#fopen Muestreo1 "muestreoc5-pd1.txt" read
#declare Fm1=0;
#declare Frames1=0;
Declare_From(Fm1,0)
#while(Frames1<(Dur))
#read (Muestreo1,S1)
Declare_To(Fm1,(Frames1)/(Dur-1),S1)
#declare Frames1=Frames1+1;
#end
sphere{0,1 translate<Fm1,0,0>}...etc....

where:
Dur is the dur in frames of the anim.
Fm1 is the name of variable ,S1 is the value of the "next variable" in the
list of textfile.(muestreoc5-pd1.txt)
this works fine but I don`t sure if this is the most efficient...
there is some other way to do it??????

thanks a lot!!!


Post a reply to this message

From: Slime
Subject: Re: please help me with #read
Date: 21 Jun 2006 03:28:49
Message: <4498f531$1@news.povray.org>
I'm not familiar with the autoclock include file, but here's how I would do
it (untested code):

#fopen Muestreo1 "muestreoc5-pd1.txt" read
#declare FileFrame = 1;
#while (FileFrame <= frame_number)
    #read (Muestreo1, Fm1)
    #declare FileFrame = FileFrame + 1;
#end
sphere{0,1 translate<Fm1,0,0>}...etc....

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: ferrari
Subject: Re: please help me with #read
Date: 22 Jun 2006 11:35:00
Message: <web.449ab79d8a9700682e10ed0e0@news.povray.org>
thanks for your help.
this is exactly what I needed.


Post a reply to this message

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