|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2015-09-01 07:25 AM (-4), Norbert Kern wrote:
> #declare IterFn =
> function (N, Re, Im, Zr, Zi) {
> select (
> N > 300 | Zr*Zr+Zi*Zi > 4,
> 0,
> IterFn (N+1, Re, Im, Zr*Zr-Zi*Zi+Re, 2*abs (Zr*Zi)+Im),
> N/300
> )
> }
Reducing the recursion level does not prevent the crash. I tried all
the way down to 1.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Cousin Ricky <ric### [at] yahoocom> wrote:
> On 2015-09-01 07:25 AM (-4), Norbert Kern wrote:
> > #declare IterFn =
> > function (N, Re, Im, Zr, Zi) {
> > select (
> > N > 300 | Zr*Zr+Zi*Zi > 4,
> > 0,
> > IterFn (N+1, Re, Im, Zr*Zr-Zi*Zi+Re, 2*abs (Zr*Zi)+Im),
> > N/300
> > )
> > }
>
> Reducing the recursion level does not prevent the crash. I tried all
> the way down to 1.
The reason for this, I believe, is that pic doesn't support recursive functions.
You can get away with exactly one, if -and only if- it is defined before
anything else in the file.
Regards,
A.D.B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> Cousin Ricky <ric### [at] yahoocom> wrote:
> > On 2015-09-01 07:25 AM (-4), Norbert Kern wrote:
> > > #declare IterFn =
> > > function (N, Re, Im, Zr, Zi) {
> > > select (
> > > N > 300 | Zr*Zr+Zi*Zi > 4,
> > > 0,
> > > IterFn (N+1, Re, Im, Zr*Zr-Zi*Zi+Re, 2*abs (Zr*Zi)+Im),
> > > N/300
> > > )
> > > }
> >
> > Reducing the recursion level does not prevent the crash. I tried all
> > the way down to 1.
>
> The reason for this, I believe, is that pic
pov* -- stupid ipod.
anyway... it causes your system to crash, or just causes povray to crash?
Regards,
A.D.B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> anyway... it causes your system to crash, or just causes povray to crash?
>
> Regards,
> A.D.B.
Hi Anthony,
only povray. I condensed the problem in perhaps 100 steps by deleting nearly
everything including tests with 3.6 and on a second pc.
There were similar problems with other (typically recursive) functions in the
past, but here I was getting angry, because I like this special fractal very
much.
Norbert
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 01.09.2015 um 13:25 schrieb Norbert Kern:
> Hi,
> here is minimal code for the famous burning ship fractal.
> It renders fine as long as I don't include functions.inc (in another context I
> need functions.inc).
> Does anybody know the reason?
Yes: POV-Ray doesn't officially support recursive functions.
It works in /some/ cases, but has some quite severe limitations; my
personal recommendation would be to create one function for each level
of recursion; that shouldn't be too difficult using a #for loop and the
Parse_String() macro from strings.inc.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
scott <sco### [at] scottcom> wrote:
> >> 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:
Wouldn't it use less memory to have only two functions that you #declare and
#undef within the loop?
http://news.povray.org/povray.binaries.scene-files/thread/%3C4ddda4d9%40news.povray.org%3E/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel Benge" <stb### [at] hotmailcom> wrote:
> scott <sco### [at] scottcom> wrote:
> > You can get around the problem by unrolling the iteration into 300
> > different functions in an array:
>
> Wouldn't it use less memory to have only two functions that you #declare and
> #undef within the loop?
Nevermind, I'm pretty sure using only two doesn't save memory :/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 02.09.2015 um 18:06 schrieb Samuel Benge:
> "Samuel Benge" <stb### [at] hotmailcom> wrote:
>> scott <sco### [at] scottcom> wrote:
>>> You can get around the problem by unrolling the iteration into 300
>>> different functions in an array:
>>
>> Wouldn't it use less memory to have only two functions that you #declare and
>> #undef within the loop?
>
> Nevermind, I'm pretty sure using only two doesn't save memory :/
... and you're pretty right ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|