POV-Ray : Newsgroups : povray.general : Fractals with functions Server Time
5 Aug 2024 12:21:58 EDT (-0400)
  Fractals with functions (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Pyry
Subject: Fractals with functions
Date: 1 Oct 2002 03:20:03
Message: <web.3d994bde346c153a084dc010@news.povray.org>
btw. This is my first time posting here. =)

Is there a way to create a fractal(mandelprot) pattern with the function
pattern or a 4D-julia with the isosurface?

I'd like to desing my own fractals with POV-ray, but because #declare c = x;
isn't the pattern x-variable(The c ends up as a vector <1,0,0>) I don't
know how. =(


Post a reply to this message

From: Warp
Subject: Re: Fractals with functions
Date: 1 Oct 2002 11:18:01
Message: <3d99bca9@news.povray.org>
Pyry <fro### [at] suomi24fi> wrote:
> Is there a way to create a fractal(mandelprot) pattern with the function
> pattern or a 4D-julia with the isosurface?

  You can create the mandelbrot and julia sets using the patterns with
the same names.
  However, you can't create recursive fractal functions (because functions
don't allow recursion).

  I can say that recursion support was tested before the final 3.5 was
released, and I even successfully made a mandelbrot function with it, but
due to several problems which arose, it was decided to not to include
support for that.

  By the way, the mandelbrot function looked like this:

#declare MaxIter = 30;

#declare MandIter =
  function(Re, Im, Zr, Zi, n)
  {
    select(n<MaxIter & Zr*Zr+Zi*Zi<4, 0, n,
      MandIter(Re, Im, Zr*Zr-Zi*Zi+Re, 2*Zr*Zi+Im, n+1))
  }

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

  Usage example:

box
{ <-2,-1.5,0>, <1,1.5,.1>
  pigment
  { function { Mandel(x,y,z) }
    color_map { [0 rgb z*.5][1 rgb <.5,.75,1>][1 rgb 0] }
  }
  finish { ambient 1 }
}


  Naturally it was slower than using the internal mandlebrot pattern,
but in no way unacceptably slow.

  It's a real pitty that it was dropped... :(

-- 
#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 11:45:35
Message: <3d99c31f$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message news:3d99bca9@news.povray.org...
> Pyry <fro### [at] suomi24fi> wrote:
> > Is there a way to create a fractal(mandelprot) pattern with the function
> > pattern or a 4D-julia with the isosurface?
>
>   You can create the mandelbrot and julia sets using the patterns with
> the same names.
>   However, you can't create recursive fractal functions (because functions
> don't allow recursion).
>

Just out of curiosity, would it not be possible to hard-code the recursion in
some way? It would lead to an 'orribly long function, but can it be done?

I've no idea how to do such a thing for a fractal*, but e.g.:

#declare Rec_func = function(x,y,z){
  pow(pow(pow(x,0.5),0.5),0.5) *
  pow(pow(pow(y,0.5),0.5),0.5)
}


*although I'm tempted to try tonight


Post a reply to this message

From: Philippe Lhoste
Subject: Re: Fractals with functions
Date: 1 Oct 2002 12:21:44
Message: <Xns929ABA8048BC1PhiLho@204.213.191.226>
"Tom Melly" <tom### [at] tomandlucouk> wrote in news:3d99c31f$1@news.povray.org:

> Just out of curiosity, would it not be possible to hard-code the
> recursion in some way? It would lead to an 'orribly long function, but
> can it be done? 
> 
> I've no idea how to do such a thing for a fractal*, but e.g.:
> 
> #declare Rec_func = function(x,y,z){
>   pow(pow(pow(x,0.5),0.5),0.5) *
>   pow(pow(pow(y,0.5),0.5),0.5)
> }

pow pow pow... Good rythm...

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

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

Goto Latest 10 Messages Next 4 Messages >>>

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