|
|
I am trying to automatically create an array of splines whose
control points are determined by 3 other splines (hope I'm clear !!).
However, the spline function does not allow me to "redefine"
a spline, e.g. using the same name as a previous one.
So, I had to generate a random name for each new spline, but,
at the last spline initialisation, POV-Ray tells me that "SplineName"
is an undeclared identifier !!!
Help ! Here's the code :
#init_3d_spline
{"Spline1",natural,<0,0,0>,<2,3,5>,<6,4,10>,<5,6,15>,<7,8,20>}
#init_3d_spline
{"Spline2",natural,<0,2,0>,<2,6,4>,<5,8,12>,<6,12,12>,<7,18,22>}
#init_3d_spline
{"Spline3",natural,<0,4,0>,<1,10,6>,<6,16,8>,<5,22,11>,<6,28,15>}
#declare Position = 0;
#while (Position < 1)
//generate a string with random append number
#declare SplineName = concat ("Spline_",str(rand(r1)*1000,0,0))
//display the generated name
#debug SplineName
#debug "\n"
//check if SplineName has been well defined. Output shows no
problem...
#ifndef (SplineName)
#debug "string is NOT defined \n"
#else
#debug "string is defined \n"
#end
//defines the new spline. works for every spline, except
//the last of the loop !!
#init_3d_spline {SplineName,natural,
eval_3d_spline ("Spline1",Position),
eval_3d_spline ("Spline2",Position),
eval_3d_spline ("Spline3",Position)
}
#declare Position = Position + .2;
#end
Post a reply to this message
|
|
|
|
Wasn't it Fabien Mosen who wrote:
> I am trying to automatically create an array of splines whose
>control points are determined by 3 other splines (hope I'm clear !!).
>
> However, the spline function does not allow me to "redefine"
>a spline, e.g. using the same name as a previous one.
>
> So, I had to generate a random name for each new spline, but,
>at the last spline initialisation, POV-Ray tells me that "SplineName"
>is an undeclared identifier !!!
Here's a little bit of a clue about what's going on:-
The problem doesn't really happen during the last pass of the loop, it
happens after the loop has completed. If you add an extra #debug
statement *after* the #init_3d_spline command, you can see that the
parsing of the last spline appears to have completed successfully.
Another feature of the problem is that it is related to the #while
processing. It's possible to solve the problem by the rather inelegant
mechanism of unwinding the #while loop, and having a long series like
this:-
#declare Position = Position + .2;
#declare SplineName = concat ("Spline_",str(rand(r1)*1000,0,0))
#init_3d_spline {SplineName,natural,
eval_3d_spline ("Spline1",Position),
eval_3d_spline ("Spline2",Position),
eval_3d_spline ("Spline3",Position)
}
#declare Position = Position + .2;
#declare SplineName = concat ("Spline_",str(rand(r1)*1000,0,0))
#init_3d_spline {SplineName,natural,
eval_3d_spline ("Spline1",Position),
eval_3d_spline ("Spline2",Position),
eval_3d_spline ("Spline3",Position)
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|