POV-Ray : Newsgroups : povray.general : Fractals with functions Server Time
5 Aug 2024 14:18:14 EDT (-0400)
  Fractals with functions (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: Fractals with functions
Date: 1 Oct 2002 12:44:54
Message: <3d99d105@news.povray.org>
Tom Melly <tom### [at] tomandlucouk> wrote:
> Just out of curiosity, would it not be possible to hard-code the recursion in
> some way?

  The number of recursions done depends on the given coordinates and thus
is not fixed.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Tom Melly
Subject: Re: Fractals with functions
Date: 1 Oct 2002 12:51:57
Message: <3d99d2ad@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message news:3d99d105@news.povray.org...
> Tom Melly <tom### [at] tomandlucouk> wrote:
> > Just out of curiosity, would it not be possible to hard-code the recursion
in
> > some way?
>
>   The number of recursions done depends on the given coordinates and thus
> is not fixed.

Would it matter? I mean, normally you break out of the recursion if the value
goes above a certain level, so it would be an inefficient "loop", but wouldn't
the result be the same?

I only know about mandelbrot - have I missed an issue with other fractal-types?
(or just not understood the problem ;)


Post a reply to this message

From: Warp
Subject: Re: Fractals with functions
Date: 1 Oct 2002 13:29:48
Message: <3d99db8c@news.povray.org>
Tom Melly <tom### [at] tomandlucouk> wrote:
> Would it matter? I mean, normally you break out of the recursion if the value
> goes above a certain level, so it would be an inefficient "loop", but wouldn't
> the result be the same?

  The return value of the loop is how many times the recursive call was
done.
  See the problem?-)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Tom & Lu Melly
Subject: Re: Fractals with functions
Date: 1 Oct 2002 14:44:35
Message: <3d99ed13@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3d99db8c@news.povray.org...
>
>   The return value of the loop is how many times the recursive call was
> done.
>   See the problem?-)
>

Ah - I *think* that you're thinking of a different approach (which maybe
because my approach is unworkable - and it would certainly start to look
very messy after more than a couple of dozen recursions). No, I was thinking
of having each required recursion already coded - i.e. if you wanted 20
recursions the function-code would be approx. 2 times longer than for 10
recursions.

Anyway, I'll have a play tonight. I can't think of any concievable use for
such an approach as mine except for killing cats...


Post a reply to this message

From: Christopher James Huff
Subject: Re: Fractals with functions
Date: 1 Oct 2002 15:24:59
Message: <chrishuff-15AD2F.15221801102002@netplex.aussie.org>
In article <3d99d105@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   The number of recursions done depends on the given coordinates and thus
> is not fixed.

I think you could do it using the select() feature to just stop 
computation past a certain point...it would still "recurse", but the 
additional levels wouldn't have to do anything. It would be horribly 
complex, slow, and ugly, and would be limited to a low number of 
recursions, but I think it is "possible".

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Simon Adameit
Subject: Re: Fractals with functions
Date: 1 Oct 2002 15:44:41
Message: <3d99fb29@news.povray.org>
"Warp" wrote:
>
>   The number of recursions done depends on the given coordinates and thus
> is not fixed.
>

Its slow but it can be done:

camera{
 location -z
 look_at 0
}

#declare MaxIter = 5;

#macro _Zr(n,I)
 #if(n<I)
  (_Zr(n+1,I)*_Zr(n+1,I)-_Zi(n+1,I)*_Zi(n+1,I)+Re)
 #else
  (Zr*Zr-Zi*Zi+Re)
 #end
#end

#macro _Zi(n,I)
 #if(n<I)
  (2*_Zr(n+1,I)*_Zi(n+1,I)+Im)
 #else
  (2*Zr*Zi+Im)
 #end
#end

#macro MakeFun(n)
 select(n<MaxIter & _Zr(0,n)*_Zr(0,n)+_Zi(0,n)*_Zi(0,n)<4, 0, n,
  #if(n<MaxIter)
   MakeFun(n+1)
  #else
   0
  #end
 )
#end

#declare MandIter=
function(Re, Im, Zr, Zi, n){
 MakeFun(0)
}

#declare Mandel = function { MandIter(x, y, x, y, 0)/MaxIter }

plane{z,0
 pigment{ function { Mandel(x,y,z) }
    color_map { [0 rgb z*.5][1 rgb <.5,.75,1>][1 rgb 0] }
    scale 0.3
  }
  finish { ambient 1 }
}


Post a reply to this message

From: Simon Adameit
Subject: Re: Fractals with functions
Date: 1 Oct 2002 16:36:28
Message: <3d9a074c@news.povray.org>
>
> I think you could do it using the select() feature to just stop
> computation past a certain point...it would still "recurse", but the
> additional levels wouldn't have to do anything. It would be horribly
> complex, slow, and ugly, and would be limited to a low number of
> recursions, but I think it is "possible".
>

I dont understand why it would still "recurse" after one select() did not
pick the next select() but for example 0.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Fractals with functions
Date: 1 Oct 2002 17:18:18
Message: <chrishuff-E3D311.17153301102002@netplex.aussie.org>
In article <3d9a074c@news.povray.org>, "Simon Adameit" <gom### [at] gmxde> 
wrote:

> I dont understand why it would still "recurse" after one select() did not
> pick the next select() but for example 0.

Eh, right. That code is still there, just most of the work is done at 
parse time, and not all of it will execute. And there is a lot more code 
than the equivalent recursive function, it could probably go above the 
limit pretty easily.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Pyry
Subject: Re: Fractals with functions
Date: 2 Oct 2002 11:55:14
Message: <web.3d9b16156657449f398d8dbb0@news.povray.org>
Simon Adameit wrote:
>
>Its slow but it can be done:
>
>camera{
> location -z
> look_at 0
>}
>
>#declare MaxIter = 5;
>
>#macro _Zr(n,I)
> #if(n<I)
>  (_Zr(n+1,I)*_Zr(n+1,I)-_Zi(n+1,I)*_Zi(n+1,I)+Re)
> #else
>  (Zr*Zr-Zi*Zi+Re)
> #end
>#end
>
>#macro _Zi(n,I)
> #if(n<I)
>  (2*_Zr(n+1,I)*_Zi(n+1,I)+Im)
> #else
>  (2*Zr*Zi+Im)
> #end
>#end
>
>#macro MakeFun(n)
> select(n<MaxIter & _Zr(0,n)*_Zr(0,n)+_Zi(0,n)*_Zi(0,n)<4, 0, n,
>  #if(n<MaxIter)
>   MakeFun(n+1)
>  #else
>   0
>  #end
> )
>#end
>
>#declare MandIter=
>function(Re, Im, Zr, Zi, n){
> MakeFun(0)
>}
>
>#declare Mandel = function { MandIter(x, y, x, y, 0)/MaxIter }
>
>plane{z,0
> pigment{ function { Mandel(x,y,z) }
>    color_map { [0 rgb z*.5][1 rgb <.5,.75,1>][1 rgb 0] }
>    scale 0.3
>  }
>  finish { ambient 1 }
>}
>

Thank you for this code. =)
It's a bit too slow but it's nice to see it can be done.
I think I'll use other fractal programs and import the pictures to POV when
I need them.

If you want challenge make a code that can recurse any fractal. Like 2^z+c
etc.


Post a reply to this message

From:
Subject: Re: Fractals with functions
Date: 4 Oct 2002 17:03:11
Message: <3d9e029c.794194140@news.povray.org>
On Tue, 1 Oct 2002 21:43:52 +0200, "Simon Adameit" <gom### [at] gmxde>
wrote:
>
>"Warp" wrote:
>>
>>   The number of recursions done depends on the given coordinates and thus
>> is not fixed.
>>
>
>Its slow but it can be done:

Sure eats a lot of memory fast, 5 iteratations take 5 MB, 10 makes
function too complex.

/Erkki


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

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