POV-Ray : Newsgroups : povray.binaries.images : SimpleFunction ... : Re: SimpleFunction ... Server Time
15 Aug 2024 22:17:36 EDT (-0400)
  Re: SimpleFunction ...  
From:
Date: 17 Apr 2002 03:06:27
Message: <ik6qbu8h0s4b4pedqf9upp69r30e04kcma@4ax.com>
On Tue, 16 Apr 2002 17:40:12 +0200, "Jan Walzer" <jan### [at] lzernet> wrote:
> #declare P_func = function(x,y,z) { f_bozo(x,y,z) }
> #declare F = function(x,y,z) {
>    P_func(
>            x/20,
>            y*3-f_noise3d(x+y*0.2,0,0)*5,
>            z*3-f_noise3d(x+z*0.2,0,0)*5
>          )
>    }
> #declare MyIso=isosurface { function{F(x/0.4,y*4,z*4)} ...

1. No need to encapsulate f_bozo as additional token P_func. Some day I asked
in p.a-u if it is just assigned or makes another level of reference. There was
no answer..

2. I think that calling f_noise twice with the same parameters is slower than
calculating it ones and pass as fourth parameter to the function.

3. No need for double scaling of parameters. You can even avoid scaling of
parameters if you properly scale whole isosurface.

My proposition is:

#declare F = function(x,y,z,N) { f_bozo( x, y-N, z-N ) }

#declare MyIso=isosurface {
  function{ F(x/8,y*12,z*12,f_noise3d(x/0.4+y*0.8,0,0)*5) } ...

or with scaling

#declare F = function(x,y,z,N) { f_bozo( x, y-N, z-N ) }

#local Scale=<8,1/12,1/12>;
#declare IsoMin=(-x-2)/Scale;
#declare IsoMax=(x+2)/Scale;

#declare MyIso=isosurface {
    function{ F(x,y,z,f_noise3d(20*x+y/15,0,0)*5) } ...
    contained_by {box { IsoMin IsoMax}}}
    scale Scale

ABX


Post a reply to this message

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