|
|
Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/29/2018 3:57 PM, Tor Olav Kristensen wrote:
> > 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
> >
>
> I tried this code:
>
> #declare f_test = function(var1,var2,var3)
> {pow(var1,2)+pow(var2,2)+pow(var3,2)-1-0.5*f_noise3d(var1*3,var2*3,var3*3)}
> #declare f_normalized = function(var1,var2,var3,varA,varB,varC)
>
{f_test(var1,var2,var3)/sqrt(4*pow(var1,2)/pow(varA,4)+4*pow(var2,2)/pow(varB,4)+4*pow(var3,2)/pow(varC,4))}
>
> and this code:
>
> SetGradientAccuracy(0.0001)
> #declare f_test= function {x*x+y*y+z*z-1-0.5*f_noise3d(x*3,y*3,z*3)}
> #declare f_input = function {f_test(x,y,z)}
> #declare GradientFn = fn_Gradient(f_input)
> #declare f_normalized = function {f_input(x,y,z)/GradientFn(x,y,z)}
>
> And the latter was much slower. Is there a way to speed it up?
>
>
> Mike
No no
If you would like to create a constant thickness shell. You must use the second
code.
Post a reply to this message
|
|