POV-Ray : Newsgroups : povray.general : Passing macro as parameter : Re: Passing macro as parameter Server Time
20 Nov 2024 04:36:19 EST (-0500)
  Re: Passing macro as parameter  
From: JRG
Date: 28 Oct 2001 09:29:42
Message: <3bdc1656@news.povray.org>
Hmm, let's see if I've understood you:
you have a macro called F (X,Z) defined as follows (I guess):
F (X,Z)

*expression with X and Z*

#end

Then you have another macro you want to pass F to it as a parameter (but you
don't want it to be F(X0,Y0) where X0 and Y0 are predefined values).
Then I guess you want to evaluate F inside the second macro.

Are you using POV 3.5? If that's the case why don't you simply define the
function inside the second macro?
i.e:

#macro Macro1()
#declare F=function (X,Z) { *expression with X and Z*}

and then you can evalute F inside the macro.

--
Jonathan.

"Kilgore Trout" <lou### [at] hotmailcom> ha scritto nel messaggio
news:3bdc11b0$1@news.povray.org...
> That's sort of different from what I'm tring to do.  I'm trying to make a
> macro that can make a graph of surfaces defined by Y = F(X, Z), and I want
> to pass F(X, Z) as a parameter to the macro.  But not just one value of F,
I
> want to be able to pass the function F, so I can call it several times
> inside of the macro.  If this isn't clear, then I can post my code so you
> can see what I have so far and what I'm trying to get.  Right now I am
> declaring F outisde of the graph macro, but this is no good because I
might
> want to use two different F's in one scene.
>
> Thanks,
> Kev
>
> "JRG" <jrg### [at] hotmailcom> wrote in message
> news:3bdc0e92@news.povray.org...
> > First you define your two macros, then you can use one as a parameter
for
> > the other one:
> >
> > example (not tested)
> >
> > #macro SQUARE (A)
> > A*A
> > #end
> >
> > #macro INCR (B)
> > B+1
> > #end
> >
> > #declare c=SQUARE ( INCR (2) ); // it should give you (2+1)^2=9
> >
> >
>
>


Post a reply to this message

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