POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell Server Time
23 Feb 2025 03:31:07 EST (-0500)
  A method creat uniform thick shell (Message 41 to 45 of 45)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Horvath
Subject: Re: A method creat uniform thick shell
Date: 29 Jul 2018 22:50:31
Message: <5b5e7cf7$1@news.povray.org>
Thanks!!

Could you bundle this into an INC file please? Then I can link to the 
newsgroup message URL from within my scene.


Mike


Post a reply to this message

From: Kenneth
Subject: Re: A method creat uniform thick shell
Date: 30 Jul 2018 10:15:00
Message: <web.5b5f1c89dce0719aa47873e10@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> Note that pow(x, 2) may be faster to evaluate than x*x.

I thought that the opposite was true, that x*x would be less 'computationally
expensive' than invoking the  pow  function. I honestly don't know for sure; but
I recall something being said about this in an older thread.


Post a reply to this message

From: Mike Horvath
Subject: Re: A method creat uniform thick shell
Date: 30 Jul 2018 17:16:03
Message: <5b5f8013@news.povray.org>
I have messed around with this, and I would not call the thickness 
exactly uniform. Is it impossible to do?


Mike


Post a reply to this message


Attachments:
Download 'offset_surface_save_06.png' (60 KB)

Preview of image 'offset_surface_save_06.png'
offset_surface_save_06.png


 

From: And
Subject: Re: A method creat uniform thick shell
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

From: And
Subject: Re: A method creat uniform thick shell
Date: 1 Aug 2018 01:35:01
Message: <web.5b61463cdce0719a553b3a4d0@news.povray.org>
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

<<< Previous 10 Messages Goto Initial 10 Messages

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