  | 
  | 
 
 | 
  | 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
Can somebody tell me how to get the following concept to work...
macro ShapeMacro(Nums,Data)
       prism{ linear_sweep linear_spline 0,70,Nums,Data texture
{pigment{color Red}}}
       #end
# object {ShapeMacro (4),(<2107,1480>,<2105,1481>,<2104,1480>,<2107,1480> )}
The problem occurs in trying to split the number of sides and the data
coordinates.
Is there a way around this ?
I have a very long list of objects that will be generated by an outside
source and need to use a macro format rather than building each element
separately.
Thanks
David
 Post a reply to this message 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
David Vincent-Jones wrote:
>Can somebody tell me how to get the following concept to work...
>
>macro ShapeMacro(Nums,Data)
>       prism{ linear_sweep linear_spline 0,70,Nums,Data texture
>{pigment{color Red}}}
>       #end
># object {ShapeMacro
>(4),(<2107,1480>,<2105,1481>,<2104,1480>,<2107,1480> )} 
>
>The problem occurs in trying to split the number of sides and the data
>coordinates.
>Is there a way around this ?
Using arrays may be an option:
#macro ShapeMacro(DataArray)
   #local Num=dimension_size(DataArray,1)
   prism {  
     linear_sweep 
     linear_spline 
     0,1,
     Num
     #local i=0;
     #while (i<Num)
        DataArr[i]
        #local i=i+1;
     #end
   
     pigment{color rgb 1}
   }
#end
#declare DataArr=array [5]{
   <0,0>,
   <0,1>,
   <1,1>,
   <1,0>,
   <0,0> 
}
object {ShapeMacro(DataArr)}
>I have a very long list of objects that will be generated by an outside
>source and need to use a macro format rather than building each element
>separately.
If the outside source is an appropriatly formatted textfile you can read 
it with povray, within the prism statement
Ingo
-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/
 Post a reply to this message 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
On Mon, 2 Oct 2000 11:19:24 +0200, "David Vincent-Jones" <geo### [at] galaxynet com>
wrote:
>Can somebody tell me how to get the following concept to work...
>
>macro ShapeMacro(Nums,Data)
>       prism{ linear_sweep linear_spline 0,70,Nums,Data texture
>{pigment{color Red}}}
>       #end
># object {ShapeMacro (4),(<2107,1480>,<2105,1481>,<2104,1480>,<2107,1480> )}
>
>The problem occurs in trying to split the number of sides and the data
>coordinates.
>Is there a way around this ?
>
I would do it by using arrays of vectors. If you do it this way you can let the
macro decide how many points you have in the prism.
I have posted an example in p.b.s-f
----------------------
dav### [at] hamiltonite com
http://hamiltonite.com/
 
 Post a reply to this message 
 | 
  | 
 
 |   |  
 |   |  
 | 
  | 
 | 
  | 
 
 |   |  
 
 | 
  |