POV-Ray : Newsgroups : povray.general : Passing macro as parameter : Re: Passing macro as parameter Server Time
7 Aug 2024 07:19:56 EDT (-0400)
  Re: Passing macro as parameter  
From: Slime
Date: 28 Oct 2001 14:00:37
Message: <3bdc55d5$1@news.povray.org>
You could also have them pass the name of the macro as a string, and then
use that evalString function in strings.inc (that's not exactly what it's
called, but it's something like that).

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]

"Kilgore Trout" <lou### [at] hotmailcom> wrote in message
news:3bdc1a4a$1@news.povray.org...
> I am using 3.1 still.  I will try what you suggested with 3.5.
>
> Thanks!
> Kevin
>
> "JRG" <jrg### [at] hotmailcom> wrote in message
> news: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.