POV-Ray : Newsgroups : povray.general : Function of a function, or function as a function parameter : Re: Function of a function, or function as a function parameter Server Time
11 May 2024 22:01:54 EDT (-0400)
  Re: Function of a function, or function as a function parameter  
From: kurtz le pirate
Date: 14 Jan 2024 05:42:10
Message: <65a3ba82$1@news.povray.org>
On 12/01/2024 15:48, Chris R wrote:

> //-----------------------------------------------------------------------------
> // Translate_fn(FN,T)
> //
> #macro Translate_fn(FN,T)
>     #local _t   = <1,1,1>*T;
>     #local _tx  = _t.x;
>     #local _ty  = _t.y;
>     #local _tz  = _t.z;
> 
>     function {
>         FN(x-_tx,y-_ty,z-_tz)
>     }
> #end
> 
> // End Translate_fn
> //-----------------------------------------------------------------------------
> 
> Usage:
> #local _my_function = function(x,y,z) { x*y - z }
> #local _my_trans_function = Translate_fn(_my_function, <1,1,1>)


Hello,


Yes, this works well for functions.
But what about macro in parameter of a macro ?


I explain what I want to do :

* I have several macros :

#macro M1 (a,b,c) ... #end
#macro M2 (a,b,c) ... #end
#macro M2 (a,b,c) ... #end

 * And an other :

#macro MACRO (V1, V2, Macro)
  #local X = ...;
  #local Y = ...;
  #local C = ...,
  Macro(X,Y,C)
#end


I'd like to be able to give at MACRO, M1, M2, ... like that :
MACRO (P, Q, M1) or MACRO (R, S, M2)


Parse_String(String) doesn't seem to be usable, but I'm not sure I
understand how it works ;)


-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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