POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell : Re: A method creat uniform thick shell Server Time
7 May 2024 11:44:13 EDT (-0400)
  Re: A method creat uniform thick shell  
From: And
Date: 1 Aug 2018 01:15:00
Message: <web.5b6141abdce0719a553b3a4d0@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "And" <49341109@ntnu.edu.tw> wrote:
> >...
> > #local h=0.00001;
> > #local normalized_function =
> > function(var1,var2,var3)
> > {
> > input_function(var1,var2,var3)
> > /sqrt(
> > pow((input_function(var1+h,var2,var3)-input_function(var1,var2,var3))/h,2)
> > +pow((input_function(var1,var2+h,var3)-input_function(var1,var2,var3))/h,2)
> > +pow((input_function(var1,var2,var3+h)-input_function(var1,var2,var3))/h,2)
> > )
> > }
> >...
>
> 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 suspect that this will be a little faster, since fn_Gradient() uses f_r()
> instead of sqrt() and pow() and since the division by h (or 2*h in fn_Gradient)
> is moved outside.
>
> Here's the relevant documentation pages:
> http://www.povray.org/documentation/view/3.6.1/460/
> http://www.povray.org/documentation/3.7.0/r3_4.html#r3_4_9_1_12_3
>
> --
> Tor Olav
> http://subcube.com

Oh, okay.


Post a reply to this message

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