POV-Ray : Newsgroups : povray.binaries.images : problem with functions.inc : Re: problem with functions.inc Server Time
28 Jun 2024 21:56:33 EDT (-0400)
  Re: problem with functions.inc  
From: Norbert Kern
Date: 2 Sep 2015 04:15:00
Message: <web.55e6af2efed76a769dd03fb90@news.povray.org>
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

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