POV-Ray : Newsgroups : povray.general : Fractals with functions : Re: Fractals with functions Server Time
5 Aug 2024 10:20:30 EDT (-0400)
  Re: Fractals with functions  
From: Simon Adameit
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

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