POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell : Re: A method creat uniform thick shell Server Time
7 May 2024 03:11:59 EDT (-0400)
  Re: A method creat uniform thick shell  
From: Tor Olav Kristensen
Date: 29 Jul 2018 16:00:00
Message: <web.5b5e1c39dce0719add67a8b80@news.povray.org>
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

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