POV-Ray : Newsgroups : povray.binaries.images : problem with functions.inc : Re: problem with functions.inc Server Time
29 May 2024 05:25:13 EDT (-0400)
  Re: problem with functions.inc  
From: scott
Date: 2 Sep 2015 03:16:16
Message: <55e6a240$1@news.povray.org>
>> declaring *any* function before your IterFn causes the crash.
>

>
> Thanks very much

You can get around the problem by unrolling the iteration into 300 
different functions in an array:


#declare MAX_ITERATIONS = 300;

#declare Fns = array[MAX_ITERATIONS];
#declare Fns[MAX_ITERATIONS-1] = function (N, Re, Im, Zr, Zi) { 0 }
#local ITERATION = MAX_ITERATIONS-2;
#while(ITERATION>=0)

#declare Fns[ITERATION] =
function (N, Re, Im, Zr, Zi) {
         select (
                 Zr*Zr+Zi*Zi > 4,
                 0,
                 Fns[ITERATION+1] (N+1, Re, Im, Zr*Zr-Zi*Zi+Re, 2*abs 
(Zr*Zi)+Im),
                 ITERATION/300
         )
}

#local ITERATION=ITERATION-1;
#end

#declare BurningShip = function (Re, Im) {Fns[0] (0, Re, Im, Re, Im)}


Post a reply to this message

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