POV-Ray : Newsgroups : povray.binaries.images : Shortest code ever for mandel landscape made of spheres : Shortest code ever for mandel landscape made of spheres Server Time
19 Aug 2024 04:24:43 EDT (-0400)
  Shortest code ever for mandel landscape made of spheres  
From: Warp
Date: 18 Jan 2001 06:22:55
Message: <3a66d20e@news.povray.org>
For very long time I thought that this was the shortest way of getting
a decent-looking mandelbrot landscape made of spheres with MegaPov:

camera{location 2look_at 0}light_source{9,1}$R=-2;#while(R<1)$I=-2;#while
(I<2)$A=R;$B=I;$N=0;#while($T=B*B;N<9&A*A+T<4)$B=2*A*B+I;$A=A*A-T+R;$N=
N+1;#end sphere{<R,N/9,I>.02pigment{bozo}}$I=I+.03;#end$R=R+.03;#end

  However, I just realized that I have been wrong all the time. There's a
much shorter way of doing the same:

camera{location 2look_at 0}light_source{9,1}$R=-2;#while
(R<1)$I=-2;#while(I<2)sphere{<R,eval_pattern(mandel 9,
<R,I>),I>.02pigment{bozo}}$I=I+.03;#end$R=R+.03;#end

  In practice this makes the exact same thing as the previous. (Images made
with both codes included at the end of the article.)

  By the way, can you guess what does this code do without rendering it?
(Answer forwared to this article)

#macro A()int(rand(R)*4)*90#end$P=union{torus{1,.05translate<1,0,-1>}
torus{1,.05translate<-1,0,1>}cylinder{-y,y,.05}clipped_by{box{-1,1}}}
$R=seed(1);light_source{<99,30,-30>1}camera{location<9,6,-13>look_at
0angle 35}$Z=-11;#while(Z<21)$Y=-11;#while(Y<12)$X=-13;#while(X<12
)object{P rotate<A(),A(),A()>translate<X,Y,Z>no_shadow pigment{
rgb<1,.5>}finish{specular.5}}$X=X+2;#end$Y=Y+2;#end$Z=Z+2;#end


Post a reply to this message


Attachments:
Download 'mandel1.jpg' (33 KB) Download 'mandel2.jpg' (32 KB)

Preview of image 'mandel1.jpg'
mandel1.jpg

Preview of image 'mandel2.jpg'
mandel2.jpg


 

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