|
|
scott <sco### [at] scottcom> wrote:
> 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)}
wow, it works!
Thank you very much.
Norbert
Post a reply to this message
|
|