POV-Ray : Newsgroups : povray.general : Pass array to macro. : Pass array to macro. Server Time
18 Apr 2024 08:25:43 EDT (-0400)
  Pass array to macro.  
From: kurtz le pirate
Date: 12 Apr 2020 05:12:36
Message: <5e92db84$1@news.povray.org>
Hello,

With this code :

...
#declare ListOfLines = array[nbLines][2];
...
#macro drawLine(thisLine,lRadius,lColor)
   cylinder {
     thisLine[0], thisLine[1], lRadius
     pigment { color lColor }
     finish { specular 1 brilliance 2 }
     }
#end
...
#declare lineIndex=0;
#while(lineIndex<nbLines)
   drawLine(ListOfLines[lineIndex],0.05, GreenYellow) <<< error here !
   #declare lineIndex= lineIndex+1;
#end

The array "ListOfLines" contains start and end points of lines.

ListOfLines[i][0]=<x1,y1,z1>;
ListOfLines[i][2]=<x2,y2,z2>;
and so on


Running this code raise en error :
   Parse Error: Expected '[', ,  found instead
for the line highlighted above


The macro drawLine can't understand that "thisLine" parameter is an 
array of two elements.
So it seems that i can't pass an array as a parameter to a macro ?

Is my prognosis correct and is there any solution (other than split 
array's item into two variables).


Thanks



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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