POV-Ray : Newsgroups : povray.general : how to call multiple instances of a macro? : Re: how to call multiple instances of a macro? Server Time
30 Jul 2024 12:19:27 EDT (-0400)
  Re: how to call multiple instances of a macro?  
From: [GDS|Entropy]
Date: 15 Feb 2009 14:29:05
Message: <49986d01$1@news.povray.org>
Hmm..well it seems that due to those limitations what I wish to do would 
actually be counterproductive.

The main reason that I wished to pass signs and iso func names was to create 
what would essentially be an overloaded an isosurface function builder macro 
(well..as close as pov can come to overloaded functions) that could be 
linked to various loops and PRNGs, mainly to decrease the code needed to 
accomplish certain things and compress all possible incarnations of 
isosurface into a single line macro call.

I wanted to do something similar with the build-in functions too.

It is times like these that I wish pov was more like c# and less like SDL.. 
;-)

Yeah the crapcode came about from the fact that while I was writing it, I 
thought: "hells..this isn't going to work..damned SDL" and I just stopped 
writing at that point. :-)

Ah, well..off to divine the depths of the Trace() function.

Thanks!
ian
"Christian Froeschlin" <chr### [at] chrfrde> wrote in message 
news:49985e56@news.povray.org...
> [GDS|Entropy] wrote:
>
>> Would one be able to pass signs (+ - / *)
>
> no
>
>> isosurface function names and
>
> yes (well, the function itself, not the name as string)
>
> #macro DoubleFunc(F)
>   function {2*F(x,y)}
> #end
>
> #declare f            = function(x,y){x*y}
> #declare f_double     = DoubleFunc(f)
>
>> things like atan and sin in some manner as that as well?
>
> sort of - SDL seems to handle the built-in functions
> differently from user-defined functions:
>
> #declare atan2_double = DoubleFunc(atan2) // error
> #declare atan2_double = DoubleFunc(function(x,y){atan2(x,y)}) // works
>
>> I've been trying to do something like this: (pardon the crapcode)
>
> Yuck ;) Actually I wasn't even sure if you intended
> this to return a function or a value.
>
>> You wouldn't happen to know if it is possible to concat strings as 
>> variable names, would you? #local myObj = concat(obj + i); would be 
>> great... :-D
>
> No. "POV-Ray macros are a strange mix of macros and functions",
> and yes I'm quoting the documentation ;) But that's beside the
> point, you should use an array whenever you even think about
> appending an index to a variable name in code.
>


Post a reply to this message

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