![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: KalleK
Subject: File I/O Problems && How to test if an identifier is a Float or a vector
Date: 14 Mar 2002 18:44:05
Message: <3c9135c5@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi All!
All those particelsystems let me try to build my own. Therefore I need to
write vectors to a file...
Well and now, my problem: I write a bunch of vectors to a file. Later I try
to read them in again. But now I get some floats between the vectors. The
file just consists of vectors, though.
Well, I searched the problem with #debug, but I don't know wether to use vstr
or str. I have to distinguish between vectors and floats. Is there a way? I
allways get errors like
Parse Error: Attempted to redefine float identifier as vector identifier.
Or things like this. :-(
Thanks!
cukk
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Thorsten Froehlich
Subject: Re: File I/O Problems && How to test if an identifier is a Float or a vector
Date: 15 Mar 2002 04:16:18
Message: <3c91bbe2$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> Well, I searched the problem with #debug, but I don't know wether to use
vstr
> or str.
It is very simple and I hope the manual explains it: Use vstr to turn
vectors and str to turn floats into strings.
Thorsten
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Fri, 15 Mar 2002 10:07:43 +0100, Thorsten Froehlich wrote:
>> Well, I searched the problem with #debug, but I don't know wether to use
> vstr
>> or str.
>
> It is very simple and I hope the manual explains it: Use vstr to turn
> vectors and str to turn floats into strings.
That's not the question. He has an identifier that he's just #read from
a file, but doesn't know if it's a float or a vector.
The following isn't tested, but should work. Just replace the two #debug
statements with whatever sort of output you're seeking.
#macro ScalarOrVector( A )
#local C = rgbft 0 + A;
#local D = A+1;
#local E = rgbft 0 + D;
#if ( C.filter = C.red & E.filter = E.red)
#debug "scalar\n"
#else
#debug "vector\n"
#end
#end
--
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: KalleK
Subject: Re: File I/O Problems && How to test if an identifier is a Float or a vector
Date: 17 Mar 2002 08:40:17
Message: <3c949cc1$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> It is very simple and I hope the manual explains it: Use vstr to turn
> vectors and str to turn floats into strings.
>
> Thorsten
Well, thanks, Thorsten.
But that was not exactly my problem. I #wrote only vectors to file, but when
I #read them in again, and tried to put them in a already declared
(array-)vector-identifier, I got errors like described in the first post.
I wanted to #debug and to see the content of what I #read out of the file.
Therefore I have to convert those (strange) mix of vectors and floats to
Strings. But how can I decide wether there's a vector or a float within my
identifier. I asked if there's a method like "isNumber(<identifier>)" and
"isVector(<identifier>)"...
Then I could use str of vstr, of course.
But I decided to work around that problem, by #writing to a file and
#including this one lateron instead of #reading it. (That's the way, it's
done in the examplefile life.pov)
Thank you anyway...
Kalle
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: KalleK
Subject: Re: File I/O Problems && How to test if an identifier is a Float or a vector
Date: 17 Mar 2002 09:01:48
Message: <3c94a1cc$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> #macro ScalarOrVector( A )
>
> #local C = rgbft 0 + A;
> #local D = A+1;
> #local E = rgbft 0 + D;
>
> #if ( C.filter = C.red & E.filter = E.red)
> #debug "scalar\n"
> #else
> #debug "vector\n"
> #end
>
> #end
Thank you Ron, I wil have a look into it.
Kalle
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I just had to start Povray 3.5 and wasn't ready to download 13 yet...
Kalle
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |