POV-Ray : Newsgroups : povray.general : Spline problems (MegaPOV) Server Time
9 Aug 2024 13:19:27 EDT (-0400)
  Spline problems (MegaPOV) (Message 1 to 3 of 3)  
From: Fabien Mosen
Subject: Spline problems (MegaPOV)
Date: 21 Jul 2000 00:53:03
Message: <3977D5FD.7E4EB3F@skynet.be>
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

From: Mike Williams
Subject: Re: Spline problems (MegaPOV)
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

From: Fabien Mosen
Subject: Re: Spline problems (MegaPOV)
Date: 22 Jul 2000 03:27:48
Message: <39794BC3.5E3C9883@skynet.be>
Mike Williams wrote:

> 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:-

Well, I think this could definitely be called a bug :-(
(which is annoying, because I need this "feature" in my next IRTC
 entry)

I even tried to simulate a loop using #include file, but the
issue is the same...

I finally had to make a script that write every sentence into a file,
as in your example.  It works nicely, but lacks the elegance and
versatility it would have if I could use "ordinary" loops.

Fabien.


Post a reply to this message

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