POV-Ray : Newsgroups : povray.general : Spline problems (MegaPOV) : Re: Spline problems (MegaPOV) Server Time
9 Aug 2024 11:25:17 EDT (-0400)
  Re: Spline problems (MegaPOV)  
From: Mike Williams
Date: 21 Jul 2000 03:31:05
Message: <jNKTeDAav$d5EwgO@econym.demon.co.uk>
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

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