POV-Ray : Newsgroups : povray.advanced-users : file reading mistake Server Time
28 Jul 2024 14:30:04 EDT (-0400)
  file reading mistake (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Orchid XP v2
Subject: Re: file reading mistake
Date: 29 Jan 2006 06:44:07
Message: <43dcaa87$1@news.povray.org>
What he said.

It allows you to (for example) do a bunch of calculations, save the 
result to a file, and load it back in during the next frame of the 
animation.

POV-Ray doesn't have the ability to read arbitrary files. Nor to write 
them, really. (It can write arbitrary text files. But it can't read them 
back.)

If you wanted, I suppose you could write some kind of preprocessor which 
sticks quote marks round everything first...


Post a reply to this message

From: Alain
Subject: Re: file reading mistake
Date: 29 Jan 2006 10:10:24
Message: <43dcdae0$1@news.povray.org>
Zarkoff nous apporta ses lumieres en ce 29/01/2006 05:51:

> // File generated by SpilinEditor v1.2
> // POV-Ray v3.0 syntax
> #declare testSpln =
> lathe{
>  cubic_spline
>  14,
>  <3.630000,6.150000>,
>  <2.590000,5.280000>,
>  <1.880000,3.690000>,
>  <2.400000,1.720000>,
>  <3.370000,1.050000>,
>  <4.850000,0.690000>,
>  <6.370000,0.880000>,
>  <7.490001,1.920000>,
>  <7.410001,2.700000>,
>  <6.860000,3.320000>,
>  <6.170000,3.080000>,
>  <5.330000,3.680000>,
>  <5.120000,4.530000>,
>  <5.620000,4.950000>
> }
> // end of file
> 
> <-----
>
If that's the full content of the file, just #include it.
The lines starting by "//" are comments and will be ignored.
The rest is correct syntax for a lathe object. If the identifier name don't suit you,
just change it 
  in your editor.

-- 
Alain
-------------------------------------------------
Zoroastrianism: Shit happens half on the time.


Post a reply to this message

From: Zarkoff
Subject: Re: file reading mistake
Date: 29 Jan 2006 12:10:01
Message: <web.43dcf5effd77404147a74af70@news.povray.org>
.....
>
> POV-Ray's reading capabilities aren't meant to read "ordinary" files. Just
> stuff like this.
>
> "string", <1,1,1>, 321.514, "another_string", 4.2333, <3,6>
>

Why did they limit it? That means I have to go into all the Spline Editor
files I'm using and chop all that unreadable data off myself -- or write a
C program to do it... Which means I'd have been better off using an old DOS
type C program.

If they would have done what seems the simpler programming thing and let the
POV user format how data is read then POV-ray would soon be reading files
from Maya, Lightwave and 3D-max.

Why did they rob us of that power?

If you're going to have file reading - why not go all the way... fseek, user
formatting, etc..

fseek and file positioning and char by char reading would make the whole
file reading and writing operations more powerful.


Post a reply to this message

From: Orchid XP v2
Subject: Re: file reading mistake
Date: 29 Jan 2006 12:31:48
Message: <43dcfc04$1@news.povray.org>
> If they would have done what seems the simpler programming thing and let the
> POV user format how data is read then POV-ray would soon be reading files
> from Maya, Lightwave and 3D-max.
> 
> Why did they rob us of that power?

I agree with you.

However, they did not. The end.


As I said in my other post, it's really ment for saving variables 
between frames of an animation so you can load them back in the next frame.

Notice also that POV-Ray can *write* arbitrary text into an output file. 
Just not *read* it. (Odd, but true.)


Also note the other reply; you can read this particular file just with 
#include, since it's already in POV-Ray SDL format...


Post a reply to this message

From: Tim Nikias
Subject: Re: file reading mistake
Date: 29 Jan 2006 15:12:04
Message: <43dd2194$1@news.povray.org>
> Why did they limit it? That means I have to go into all the Spline Editor
> files I'm using and chop all that unreadable data off myself -- or write a
> C program to do it... Which means I'd have been better off using an old
DOS
> type C program.

Design decision? After all, POV-Ray is supposed to be a script-based
raytracer. It does come with this nice and handy SDL, but it's a bonus,
POV-Ray, after all, is just a raytracer. You're not supposed to be
programming with it, you're supposed to describe a scene and let it
raytrace.

Regards,
Tim

-- 
aka "Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Viktor
Subject: Re: file reading mistake
Date: 23 Jun 2006 13:25:01
Message: <web.449c233dfd77404145bc30e10@news.povray.org>
I have another strange "read" issue. Indeed I only want to transfer
variables from one frame to another, but A LOT of them. My file goes like
this:

-0.00164469
-0.0512107
0
-0.612596
-0.609269
-0.605894
-0.602472

When I read that in, by using a simple
#read (DATA, newVar)
the line with the "0" is simply ignored - instead of the 0 being saved in
"newVar". I have to convert the lines with "0" to "-0.0" ("0.0" isn't
enough) to prevent that. Is this a feature or...?

Regards,
Viktor.


Post a reply to this message

From: Warp
Subject: Re: file reading mistake
Date: 23 Jun 2006 13:54:10
Message: <449c2ac2@news.povray.org>
Try separating the values with commas.

-- 
                                                          - Warp


Post a reply to this message

From: nomail
Subject: Re: file reading mistake
Date: 24 Jun 2006 00:55:00
Message: <web.449cc533fd774041335d9630@news.povray.org>
"Viktor" <vik### [at] spamfencenet> wrote:
> -0.00164469
> -0.0512107
> 0
> -0.612596
> -0.609269
> -0.605894
> -0.602472
>
> When I read that in, by using a simple
> #read (DATA, newVar)
> the line with the "0" is simply ignored - instead of the 0 being saved in
> "newVar". I have to convert the lines with "0" to "-0.0" ("0.0" isn't
> enough) to prevent that. Is this a feature or...?

It is a RTFM!


Post a reply to this message

From: Alain
Subject: Re: file reading mistake
Date: 24 Jun 2006 12:44:02
Message: <449d6bd2$1@news.povray.org>
Viktor nous apporta ses lumieres en ce 23/06/2006 13:22:
> I have another strange "read" issue. Indeed I only want to transfer
> variables from one frame to another, but A LOT of them. My file goes like
> this:
> 
> -0.00164469
> -0.0512107
> 0
> -0.612596
> -0.609269
> -0.605894
> -0.602472
> 
> When I read that in, by using a simple
> #read (DATA, newVar)
> the line with the "0" is simply ignored - instead of the 0 being saved in
> "newVar". I have to convert the lines with "0" to "-0.0" ("0.0" isn't
> enough) to prevent that. Is this a feature or...?
> 
> Regards,
> Viktor.
> 
> 
> 
> 
It reads the data as: -0.00164469, -0.05121070 (note the extra zero), -0.612596,
-0.609269, 
-0.605894, -0.602472
The lone 0 is treated as the last digit of the preceding value. Another integer would
have been 
treated the same way, but would have been easier to spot as it would have altered the
preceding value.
Put a comma after each value but the last.

-- 
Alain
-------------------------------------------------
A short cut is the longest distance between two points.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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