POV-Ray : Newsgroups : povray.advanced-users : Macro Problem Server Time
23 Dec 2024 22:35:20 EST (-0500)
  Macro Problem (Message 1 to 3 of 3)  
From: David Vincent-Jones
Subject: Macro Problem
Date: 2 Oct 2000 05:21:29
Message: <39d85399@news.povray.org>
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

From: ingo
Subject: Re: Macro Problem
Date: 2 Oct 2000 07:22:01
Message: <8FC185E05seed7@204.213.191.228>
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

From: David Wilkinson
Subject: Re: Macro Problem
Date: 2 Oct 2000 07:54:03
Message: <ndogtsk8snr5qe302h6qre7da958p056dj@4ax.com>
On Mon, 2 Oct 2000 11:19:24 +0200, "David Vincent-Jones" <geo### [at] galaxynetcom>
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] hamiltonitecom
http://hamiltonite.com/


Post a reply to this message

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