POV-Ray : Newsgroups : povray.binaries.images : Shortest code ever for mandel landscape made of spheres Server Time
19 Aug 2024 12:20:40 EDT (-0400)
  Shortest code ever for mandel landscape made of spheres (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Warp
Subject: Shortest code ever for mandel landscape made of spheres
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


 

From: Warp
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 18 Jan 2001 06:23:45
Message: <3a66d23f@news.povray.org>


Post a reply to this message


Attachments:
Download 'pipes.jpg' (127 KB)

Preview of image 'pipes.jpg'
pipes.jpg


 

From: Mr  Art
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 18 Jan 2001 07:25:49
Message: <3A67172B.4FBD85F@chesapeake.net>
I am getting a new mental image of why you sign your
posts thhe way you do.

Warp wrote:
> 
>   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
> 
>  [Image]
> 
>  [Image]
> 
> --
> char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
> main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
> c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: David Fontaine
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 19 Jan 2001 18:49:33
Message: <3A68D147.6D05B6A6@faricy.net>
Warp wrote:

>   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

Defines an object that is two semi-torii connected by a vertical rod, going in
opposite directions from each other, and it tiles this object 23x23x23, each
one randomly rotated. There is also a typo, #while(Z<21)...

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: David Fontaine
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 19 Jan 2001 18:53:08
Message: <3A68D21F.756DDEE3@faricy.net>
David Fontaine wrote:

> Defines an object that is two semi-torii connected by a vertical rod, going in
> opposite directions from each other, and it tiles this object 23x23x23, each
> one randomly rotated. There is also a typo, #while(Z<21)...

D'oh, I was getting coordinates confused. Of course it is a truchet tile, the
quarter-torii and coplanar and the cylinder runs between them. And the rotation is
a multiple of 90.

I was completely not seeing that!

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 20 Jan 2001 08:03:53
Message: <3A698C6A.25CA6C7@online.no>
Warp wrote:
> 
>   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

It can be done with 2 characters less.
(The image below is done that way.)

So Warp, can you spot how to shorten your code ?


And your "spaghetti"-code can be shorten too.
I think the same can be done with (at least) 
11 characters less.


:)


Btw.:
What's wrong with your keyboard ?


-- 
Best regards,

Tor Olav

mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message


Attachments:
Download 'mandel.jpg' (25 KB)

Preview of image 'mandel.jpg'
mandel.jpg


 

From: Christoph Hormann
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 20 Jan 2001 10:10:53
Message: <3A69AA7D.22E3C533@gmx.de>
Tor Olav Kristensen wrote:
> 
> It can be done with 2 characters less.
> (The image below is done that way.)
> 
> So Warp, can you spot how to shorten your code ?
> 

I could not find it until now, but i have a version that is 8 characters
shorter than Warp's, although i'm not sure if you will accept it, because
it's not made of spheres.  

I also managed to eliminate one while loop from Warp's version, but that
makes it slightly larger, maybe someone can also reduce this:

camera{location 2look_at 0}light_source{9,1}$R=0;#while
(R<99)sphere{<int(R)/99,eval_pattern(mandel 9,
<(R-int(R)-.5)*3,int(R)/40-1>),R-int(R)>.01pigment{bozo}}$R=R+.02;#end 


Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 22 Jan 2001 20:34:15
Message: <3A6CDF5D.C4140793@online.no>
Christoph Hormann wrote:
> 
> Tor Olav Kristensen wrote:
> >
> > It can be done with 2 characters less.
> > (The image below is done that way.)
> >
> > So Warp, can you spot how to shorten your code ?
> >
> 
> I could not find it until now, but i have a version that is 8 characters
> shorter than Warp's, although i'm not sure if you will accept it, because
> it's not made of spheres.

Well, here's my solution:

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


If you're not doing it with spheres, then what are you using ?
Code please !


> I also managed to eliminate one while loop from Warp's version, but that
> makes it slightly larger, maybe someone can also reduce this:
> 
> camera{location 2look_at 0}light_source{9,1}$R=0;#while
> (R<99)sphere{<int(R)/99,eval_pattern(mandel 9,
> <(R-int(R)-.5)*3,int(R)/40-1>),R-int(R)>.01pigment{bozo}}$R=R+.02;#end

Interesting solution !

This reminds me of something Dan Johnson did in
his Arrange_3d macro. See his "Polyhedra include file"
thread in povray.binaries.scene-files, 11. Jan -01:

news://news.povray.org/3A67EB4C.EFE1B3BD%40hotmail.com


-- 
Best regards,

Tor Olav

mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Christoph Hormann
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 23 Jan 2001 03:11:15
Message: <3A6D3CA0.D8B4DD91@gmx.de>
Tor Olav Kristensen wrote:
> 
> Well, here's my solution:
> 
> camera{location 2look_at 0}light_source{9,1}$R=1;#while
> (R+2)$S=2;#while(S+2)sphere{<R,eval_pattern(mandel 9,
> <R,S>),S>.01pigment{bozo}}$S=S-.02;#end$R=R-.02;#end
> 

Well, that's not the obvious solution for a pascal programmer :-)

> If you're not doing it with spheres, then what are you using ?
> Code please !

camera{location 2look_at 0}light_source{9,1}height_field 
{pattern 99,99{mandel 9 color_map{[0 rgb 0][1 rgb 1]}
scale.3rotate-x*90translate.5}pigment{bozo}} 

> [...]
> 
> Interesting solution !
> 
> This reminds me of something Dan Johnson did in
> his Arrange_3d macro. See his "Polyhedra include file"
> thread in povray.binaries.scene-files, 11. Jan -01:
> 

I first tried it with mod(), but it turned out beeing ways longer.  What's
in fact missing is a frac() function returning the fractional part of a
variable (although R-int(R) does perfectly suffice apart from length :-).  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: ingo
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 23 Jan 2001 08:27:05
Message: <Xns9032931CE5942seed7@povray.org>
in <3A69AA7D.22E3C533@gmx.de> Christoph Hormann wrote:

>I also managed to eliminate one while loop from Warp's version, but that
>makes it slightly larger, maybe someone can also reduce this:
>
>camera{location 2look_at 0}light_source{9,1}$R=0;#while
>(R<99)sphere{<int(R)/99,eval_pattern(mandel 9,
><(R-int(R)-.5)*3,int(R)/40-1>),R-int(R)>.01pigment{bozo}}$R=R+.02;#end 
>
>
If it's reduction in character count what you're looking for:

camera{location 2look_at 0}light_source{9,1}$R=0;#while
(R<99)%S=int(R);sphere{<S/99,eval_pattern(mandel 9
<(R-S-.5)*3,S/40-1>)R-S>.01pigment{bozo}}$R=R+.02;#end

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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