|
|
Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/28/2018 3:18 PM, Tor Olav Kristensen wrote:
> >...
> > And, there is a macro in math.inc that can create the gradient function for your
> > denominator: fn_Gradient()
> >
> > Here's how you can use it:
> >
> > #include "math.inc"
> >
> > SetGradientAccuracy(h)
> > #local GradientFn = fn_Gradient(input_function)
> > #local normalized_function =
> > function { input_function(x, y, z)/GradientFn(x, y, z) }
>...
>...
> I don't understand the syntax.
>
> #local GradientFn = fn_Gradient(input_function)
>
> I did not know one could pass one function to another in this manner. I
> thought it was necessary to pass x, y, z instead. I.e.
>
> #local GradientFn = fn_Gradient(x,y,z)
fn_Gradient() is not a function. It is a macro within math.inc. When you pass a
function to this macro it will create and return a new function that estimates
the magnitude of the gradient of the function that you passed to it.
The function that you pass to this macro must take 3 arguments; usually x, y and
z (but their names doesn't really matter). And the function that it returns
takes 3 arguments.
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|