POV-Ray : Newsgroups : povray.unofficial.patches : Splines problems : Splines problems Server Time
2 Sep 2024 02:16:58 EDT (-0400)
  Splines problems  
From: Fabien Mosen
Date: 19 Jul 2000 16:23:48
Message: <39760D18.E7E523BC@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

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