|
|
I have a problem.
I want to read a file with successions of 6 3D vectors followed by 3 2D
vectors on each line (yes, smoothed triangles) looking like this (two
first lines):
<1.53223, 5.20003, -0.91979>, <-0.9382721, -0.3187213, -0.1343958>,
<1.55159, 5.13053, -0.89013>, <-0.9382817, -0.3187565, -0.1342448>,
<1.50766, 5.24892, -0.8642>, <-0.9382815, -0.3187583, -0.1342426>, <0.5,
1>, <0.71485, 0.85355>, <0.28515, 0.85355>,
<1.55159, 5.13053, -0.89013>, <-0.9382817, -0.3187565, -0.1342448>,
<1.47353, 5.29913, -0.74484>, <-0.9382809, -0.3187523, -0.1342607>,
<1.50766, 5.24892, -0.8642>, <-0.9382815, -0.3187583, -0.1342426>,
<0.71485, 0.85355>, <0.01267, 0.5>, <0.28515, 0.85355>,
My code looks like this:
#fopen Triangles1 "MyFile.inc" read
#while (defined(Triangles1))
#read (Triangles1, T1, T2, T3, T4, T5, T6, UV1, UV2, UV3)
etc...
#end
I get immediately a parse error at the end of the first line saying:
"Parse error: Expected 'undeclared identifier', uv vector identifier
found instead"
How should I then declare the 2D vectors in order to be read correctly?
Thanks!
Thomas
Post a reply to this message
|
|
|
|
Le 13/12/2012 10:34, Thomas de Groot nous fit lire :
> I have a problem.
> #fopen Triangles1 "MyFile.inc" read
> #while (defined(Triangles1))
> #read (Triangles1, T1, T2, T3, T4, T5, T6, UV1, UV2, UV3)
> etc...
> #end
>
> I get immediately a parse error at the end of the first line saying:
> "Parse error: Expected 'undeclared identifier', uv vector identifier
> found instead"
>
> How should I then declare the 2D vectors in order to be read correctly?
>
If I read the error message, I would conclude that at the start of the
*second* iteration, UV1 & pal are still defined
Try something like:
#fopen Triangles1 "MyFile.inc" read
#while (defined(Triangles1))
#read (Triangles1, T1, T2, T3, T4, T5, T6, UV1, UV2, UV3)
etc...
#undef UV1
#undef UV2
#undef UV3
#undef T1
#undef T2
#undef T3
#undef T4
#undef T5
#undef T6
#end
> Thanks!
>
> Thomas
Post a reply to this message
|
|
|
|
On 13-12-2012 18:51, Le_Forgeron wrote:
> If I read the error message, I would conclude that at the start of the
> *second* iteration, UV1 & pal are still defined
>
> Try something like:
>
> #fopen Triangles1 "MyFile.inc" read
> #while (defined(Triangles1))
> #read (Triangles1, T1, T2, T3, T4, T5, T6, UV1, UV2, UV3)
> etc...
> #undef UV1
> #undef UV2
> #undef UV3
> #undef T1
> #undef T2
> #undef T3
> #undef T4
> #undef T5
> #undef T6
> #end
>
Works! Thanks!
I think I understand /why/ this happened in this particular case. Within
the #while block I do a #write of some of the vectors to another file.
Before reading a new line I must first #undef them. Simple ;-)
Thomas
Post a reply to this message
|
|