POV-Ray : Newsgroups : povray.newusers : functions and macros : Re: functions and macros Server Time
18 May 2024 00:18:44 EDT (-0400)
  Re: functions and macros  
From: Bald Eagle
Date: 18 Jun 2023 14:15:00
Message: <web.648f48e21d2497941f9dae3025979125@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
> Hello,
>
>
> Can a function call a macro ?

Hi Kurtz,

You cannot use macros or arrays in functions.
Heck, there are even certain "functions" that you can't use in functions
(vlength, etc).

Under certain circumstances, you can write macros that assemble a function, and
while doing that, the macro can plug in the results of macro calls.

Or you can declare a set of values that are the result of macro call
evaluations, and use those values in your function.

The key concept is that any non-argument values in a function have to be
completely static.  So if you have a function of t, and want to do t*2, then 2
will be a static value, and can never change once the function is declared.

If you can express the types of variable results you want as separate functions,
then you can daisy-chain your functions together, such that you can write
formulas such as t*f(x).

Things can get pretty challenging trying to get the syntax right, and the
functions can get long, since we don't have vector functions, but a lot of
things are doable if you just keep trying to make it work and ask for help.

- BW


Post a reply to this message

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