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:22:28 EDT (-0400)
  Re: how to call multiple instances of a macro?  
From: Christian Froeschlin
Date: 15 Feb 2009 13:26:30
Message: <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.