POV-Ray : Newsgroups : povray.general : how to read a 2d uv vectors in pov-ray Server Time
2 Aug 2024 00:16:22 EDT (-0400)
  how to read a 2d uv vectors in pov-ray (Message 1 to 6 of 6)  
From: lien0n
Subject: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 10:35:00
Message: <web.425a8a3bc29b5505598059850@news.povray.org>
I got a code piece like follow:
  uv_vectors
  {
    #read (File,Bottom_numUV)
    Bottom_numUV,
    #local i=0;
    #local temp=<0,0>;
    #while (i<Bottom_numUV)
    #read (File,temp)            (*)
    temp
    #local i=i+1;
    #end
  }

And I also got a file like this:
16384,
<0.000000,0.992188>,
<0.007813,0.992188>,
<0.015625,0.992188>,
<0.023438,0.992188>,
....

but the parser said on the (*) line:
Parser error: Expected 'undeclared identifier', uv vector identifier found
instead

Forgive me to launch such a stupid question, but it is really important to
me,


Post a reply to this message

From: Slime
Subject: Re: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 12:00:49
Message: <425a9f31$1@news.povray.org>
I think if you put a comma after the line that just says "temp" (that is,
make it "temp,"), then it will work. It's probably failing on the second
time through the loop when it sees two UV-vectors in a row without a comma
inbetween.

Weird error message though.

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


Post a reply to this message

From: Mike Williams
Subject: Re: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 15:26:36
Message: <BqfskBAY9sWCFwgL@econym.demon.co.uk>
Wasn't it lien0n who wrote:
>I got a code piece like follow:
>  uv_vectors
>  {
>    #read (File,Bottom_numUV)
>    Bottom_numUV,
>    #local i=0;
>    #local temp=<0,0>;
>    #while (i<Bottom_numUV)
>    #read (File,temp)            (*)
>    temp
>    #local i=i+1;
>    #end
>  }
>
>And I also got a file like this:
>16384,
><0.000000,0.992188>,
><0.007813,0.992188>,
><0.015625,0.992188>,
><0.023438,0.992188>,
>....
>
>but the parser said on the (*) line:
>Parser error: Expected 'undeclared identifier', uv vector identifier found
>instead
>
>Forgive me to launch such a stupid question, but it is really important to
>me,

It's actually the "#local temp = <0,0>" line that's freaking it out. The
#read directive is, for some reason, refusing to read data into a
variable that currently contains a uv vector.

However, if you omit that line, the #read works the first time (when
'temp' is undefined), and happily reads a uv vector into 'temp'. Then on
the second pass, the #read directive refuses to read data into a
variable that currently contains the uv vector it read on the previous
pass.

A few quick tests show that all these workrounds work:

1. Have 'temp' be undefined whenever the #read is invoked

    #local i=0;
    #while (i<Bottom_numUV)
      #read (File,temp)
      temp
      #undef temp
    #local i=i+1;
    #end

2. Make 'temp' be a float whenever the #read is invoked

    #local i=0;
    #while (i<Bottom_numUV)
      #local temp = 0;
      #read (File,temp)
      temp
    #local i=i+1;
    #end

3. Make 'temp' be a 3-vector whenever the #read is invoked

    #local i=0;
    #while (i<Bottom_numUV)
      #local temp = <0,0,0>;
      #read (File,temp)
      temp
    #local i=i+1;
    #end

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Slime
Subject: Re: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 15:49:15
Message: <425ad4bb$1@news.povray.org>
> It's actually the "#local temp = <0,0>" line that's freaking it out. The
> #read directive is, for some reason, refusing to read data into a
> variable that currently contains a uv vector.

Ohh, duh. That makes more sense.

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


Post a reply to this message

From: lien0n
Subject: Re: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 21:35:00
Message: <web.425b2549dda292ef598059850@news.povray.org>
many thx~ to you all guys.

Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it lien0n who wrote:
> >I got a code piece like follow:
> >  uv_vectors
> >  {
> >    #read (File,Bottom_numUV)
> >    Bottom_numUV,
> >    #local i=0;
> >    #local temp=<0,0>;
> >    #while (i<Bottom_numUV)
> >    #read (File,temp)            (*)
> >    temp
> >    #local i=i+1;
> >    #end
> >  }
> >
> >And I also got a file like this:
> >16384,
> ><0.000000,0.992188>,
> ><0.007813,0.992188>,
> ><0.015625,0.992188>,
> ><0.023438,0.992188>,
> >....
> >
> >but the parser said on the (*) line:
> >Parser error: Expected 'undeclared identifier', uv vector identifier found
> >instead
> >
> >Forgive me to launch such a stupid question, but it is really important to
> >me,
>
> It's actually the "#local temp = <0,0>" line that's freaking it out. The
> #read directive is, for some reason, refusing to read data into a
> variable that currently contains a uv vector.
>
> However, if you omit that line, the #read works the first time (when
> 'temp' is undefined), and happily reads a uv vector into 'temp'. Then on
> the second pass, the #read directive refuses to read data into a
> variable that currently contains the uv vector it read on the previous
> pass.
>
> A few quick tests show that all these workrounds work:
>
> 1. Have 'temp' be undefined whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #read (File,temp)
>       temp
>       #undef temp
>     #local i=i+1;
>     #end
>
> 2. Make 'temp' be a float whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #local temp = 0;
>       #read (File,temp)
>       temp
>     #local i=i+1;
>     #end
>
> 3. Make 'temp' be a 3-vector whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #local temp = <0,0,0>;
>       #read (File,temp)
>       temp
>     #local i=i+1;
>     #end
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: lien0n
Subject: Re: how to read a 2d uv vectors in pov-ray
Date: 11 Apr 2005 22:35:00
Message: <web.425b335bdda292ef598059850@news.povray.org>
I tried on my computer. Only (1) works, and the last two cannot. When
working with the last two approach, same error message was given.
So it seems that i must use #undef temp to ensure temp is an undefined uv
vector variable inside each pass.

Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it lien0n who wrote:
>
> It's actually the "#local temp = <0,0>" line that's freaking it out. The
> #read directive is, for some reason, refusing to read data into a
> variable that currently contains a uv vector.
>
> However, if you omit that line, the #read works the first time (when
> 'temp' is undefined), and happily reads a uv vector into 'temp'. Then on
> the second pass, the #read directive refuses to read data into a
> variable that currently contains the uv vector it read on the previous
> pass.
>
> A few quick tests show that all these workrounds work:
>
> 1. Have 'temp' be undefined whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #read (File,temp)
>       temp
>       #undef temp
>     #local i=i+1;
>     #end
>
> 2. Make 'temp' be a float whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #local temp = 0;
>       #read (File,temp)
>       temp
>     #local i=i+1;
>     #end
>
> 3. Make 'temp' be a 3-vector whenever the #read is invoked
>
>     #local i=0;
>     #while (i<Bottom_numUV)
>       #local temp = <0,0,0>;
>       #read (File,temp)
>       temp
>     #local i=i+1;
>     #end
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

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