POV-Ray : Newsgroups : povray.general : how to read a 2d uv vectors in pov-ray : Re: how to read a 2d uv vectors in pov-ray Server Time
1 Aug 2024 22:16:08 EDT (-0400)
  Re: how to read a 2d uv vectors in pov-ray  
From: lien0n
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

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