POV-Ray : Newsgroups : povray.general : PoV can't read my array : Re: PoV can't read my array Server Time
29 Jul 2024 10:20:58 EDT (-0400)
  Re: PoV can't read my array  
From: Albun
Date: 13 Jan 2012 07:30:01
Message: <web.4f10228974e4954bf0a394290@news.povray.org>
Hi,

so i try to convert a spline to an array 1 dimension

heres is the macro i write and use for it, maybe it'll better for other multiple
dimension...



//  convert_spline_array.mcr
// eg:
//      #include "convert_spline_array.mcr"
//
//
Convert_spline_array(Traject_Spline,0,141,"circuit_array.inc","Traject_array")
//
//That's it ! It's always a little step ...

#macro Convert_spline_array(spline_name, first_pt, last_pt, output_file_name,
output_array_name)


   #declare Nbr_de_points =(last_pt-first_pt)+1;

  #fopen Data output_file_name write

        #write (Data,"\n\n")
        #write (Data,"// ",output_file_name,"  \n\n")
        #write (Data, "// A convert  Spline() to array [] made with
convert_spline_array.mcr\n")
        #write (Data, "// Author : Albun  //Date:  13/01/2012 \n\n\n")
        #write (Data, "// \n")
        #write (Data, "//  \n\n\n")

        #write (Data,"#declare ",output_array_name," = array[",Nbr_de_points,"]
{\n")  //array initialization

                #declare V=first_pt;
                #while (V<= last_pt)

        #write (Data,spline_name(V))                   // array pts
        #write (Data,", //     ",V,"\n")               // nbr of the spline pt

        #if (mod(V,4)=0 ) #write (Data, "\n") #end     // write 4 pts by 4 pts

                #declare V=V+1;
        #end

         #write (Data,"}\n")

 #fclose Data


#end //of macro convert_spline_array.mcr



Bye !


Post a reply to this message

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