POV-Ray : Newsgroups : povray.binaries.images : Shortest code ever for mandel landscape made of spheres Server Time
19 Oct 2026 06:19:38 EDT (-0400)
  Shortest code ever for mandel landscape made of spheres (Message 1 to 18 of 18)  
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

From: Warp
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 23 Jan 2001 09:07:00
Message: <3a6d9001@news.povray.org>
If we consider "decent-looking" a landscape viewed right from above, then
the code can be shortened even more:

light_source{y,1}$R=-2;#while(R<2)$I=-2;#while
(I<2)sphere{<R,I,4-eval_pattern(mandel 9,<R,I>
)>.01pigment{rgb y}}$I=I+.02;#end$R=R+.02;#end


Post a reply to this message


Attachments:
Download 'Mand_big.jpg' (87 KB) Download 'Mand.png' (30 KB) Download 'Mand_aa1.png' (40 KB) Download 'Mand_aa2.png' (33 KB)

Preview of image 'Mand_big.jpg'
Mand_big.jpg

Preview of image 'Mand.png'
Mand.png

Preview of image 'Mand_aa1.png'
Mand_aa1.png

Preview of image 'Mand_aa2.png'
Mand_aa2.png


 

From: Warp
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 23 Jan 2001 09:19:24
Message: <3a6d92ec@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
: camera{location 2look_at 0}light_source{9,1}height_field 

  The idea is to make the landscape with objects. Using a height_field is
too trivial.

-- 
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: Christoph Hormann
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 23 Jan 2001 09:20:01
Message: <3A6D930E.ECD6A348@gmx.de>
ingo wrote:
> 
> 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
> 

Oops, it seems i have totally missed that...

BTW, now it seems exactly the same length as Tor's version.

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 10:01:01
Message: <Xns9032A309EB081seed7@povray.org>
in <3A6D930E.ECD6A348@gmx.de> Christoph Hormann wrote:

>BTW, now it seems exactly the same length as Tor's version.
>

In Tor's version two more commas can be deleted,
sphere{<R,eval_pattern(mandel 9<R,S>)S>.01pigment{bozo}}

in yours one.
sphere{<S/99,eval_pattern(mandel 9<3*(R-S-.5)S/40-1>)R-S>.01pigment{bozo}}


Ingo

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


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: 23 Jan 2001 20:09:09
Message: <3A6E2AF6.DA5AD7@online.no>
Christoph Hormann wrote:
> 
> 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 :-)

Who's that Pascal programmer ?   Is it me or you ?

=)


> > 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}}

Using patterns for heightfields is new to me.

MegaPOV feature ?


> > [...]
> >
> > 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 :-).

I wonder why there are such basic functions 
missing from the POV-language.

Even my stone-age-Casio had the frac() function.


-- 
Best regards,

Tor Olav

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


Post a reply to this message

From: Chris Huff
Subject: Re: Shortest code ever for mandel landscape made of spheres => Not any more (25KB)
Date: 23 Jan 2001 22:45:43
Message: <chrishuff-0ED374.22463923012001@news.povray.org>
In article <3A6### [at] onlineno>, Tor Olav Kristensen 
<tor### [at] onlineno> wrote:

> > 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}}
> 
> Using patterns for heightfields is new to me.
> MegaPOV feature ?

Yes. And I think the keyword really should be "pigment_image", not 
"pattern", since it takes a pigment (well, pattern and color_map) and 
produces an image from it. The two numbers before (?!?) the { bracket 
specify the resolution of the image, pigment stuff goes inside the 
brackets, and I think you can use it pretty much any place that uses an 
image file.


> I wonder why there are such basic functions 
> missing from the POV-language.

They were just overlooked or didn't seem necessary...another missing 
function is "sgn()", which would return -1 or 1 depending on the sign of 
the parameter. (I've patched that one into my own version.) But people 
have gotten along for a long time without them, and now that they can be 
done easily with macros, there isn't a lot of demand for them to be 
added to the program itself.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


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: 24 Jan 2001 16:54:52
Message: <3A6F4F20.B114F2E3@gmx.de>
Tor Olav Kristensen wrote:
> 
> Who's that Pascal programmer ?   Is it me or you ?
> 
> =)
> 

;-)

> [...]
> 
> Using patterns for heightfields is new to me.
> 
> MegaPOV feature ?
> 

Yes, i'm not using it much, but it can be useful if you don't want to
carry around a large image file for example.  

> 
> I wonder why there are such basic functions
> missing from the POV-language.
> 
> Even my stone-age-Casio had the frac() function.
> 

It's not much problem IMO, because it can quickly be typed with 'R-int(R)'
or done with a macro.  I think it would probably not be much used with
povray anyway, at least less often than the 'sgn()' function Chris
mentioned.

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: Richard Morton
Subject: Re: Shortest code ever for mandel landscape made of spheres
Date: 14 Feb 2001 07:58:37
Message: <3a8a80fd$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3a6d9001@news.povray.org...
>
>   There's a funny thing about this particular scene. When rendered
> at 256x192 without antialiasing it looks like this:
>
>
I really like this version of the image - I think that it would make a good
logo for something (perhaps Morton Peas - yes there is such a product,
although nothing to do with me).


Post a reply to this message

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