POV-Ray : Newsgroups : povray.binaries.animations : Sierpinsky changing ... : Re: Sierpinsky changing ... Server Time
30 Jun 2024 04:41:40 EDT (-0400)
  Re: Sierpinsky changing ...  
From: Karl Anders
Date: 21 Feb 2007 07:05:00
Message: <web.45dc34122d375289dca0ceae0@news.povray.org>
Thibaut Jonckheere <tua### [at] MAPSONyahoofr> wrote:
>
> Nice ! But really too short or too quick: one has barely the time to see
> what happens. Can you make a slower version ?
>
>
> tuabiht

Hello Thibaut,
Thank you. My main interest in this thing is the final shape. Since this
thing parses awfully slowly on my old Mac (about two minutes per frame) and
I would like go back to different things in my sparse spare time, I propose
you do that for yourself. Since the source is quite short, I hope it will
be ok  if I append it here:

//----- cut here for sierpinsky.pov

//#include "VectorStuff.inc"
#include "transforms.inc"

#macro UnitV_XY( Phi ) // from my VectorStuff.inc; UnitVector in xy-plane
   < cos( radians( Phi ) ), sin( radians( Phi ) ), 0  >
#end //#macro UnitV_XY( phi )

#declare TransForms = array[3] ;

#declare cc = 0;
#while( cc < 3 )
 #declare TransForms[cc] =
 transform{
  scale 0.5
  rotate 60*clock*z
// angles outside 0..60 give same pictures, partially mirrored
  translate UnitV_XY( cc*120-30 )
 }
 #declare cc = cc+1;
#end // #while( cc < 3 )

#declare ptnum = 20000; // more would be better, but traces SLOWLY
#declare skip = 10;
#declare ptnum = ptnum+skip;
#declare Points = array[ptnum];

#declare MyStream = seed( 0 );

#declare cc = 0;
#declare Points[cc] = < 0,0,0 >;
#declare Points[cc] = < 2*rand(MyStream)-1, 2*rand(MyStream)-1, 0 >;

#while( cc < skip-1 )
   #declare cc = cc+1;
   #declare Points[cc] =
      vtransform( Points[cc-1], TransForms[3*rand(MyStream)] );
#end //#while( cc < skip-1 )

#while( cc < ptnum-1 )
   #declare cc = cc+1;
   #declare Points[cc] =
      vtransform( Points[cc-1], TransForms[3*rand(MyStream)] );
   sphere{ Points[cc]+4*z 0.005 pigment{ color 0 } }
#end //#while( cc < ptnum-1 )

camera {
 up y right x*image_width/image_height
}

background{ color 1 }

//----- end of sierpinsky.pov

some comments:
- "ptnum" gives the number of spheres finally traced; 20000 is MINIMUM !
- render with square picture and lowest quality settings; the spheres are
used as pixels, no reflections or shading required
- make an animation; clock going from 0...1 as usual, with as many pictures
as you want (or care to watch tracing)

This is just a quick hack, you probably don't need to put all the points
into an array, but I'm not going to work on it for the time being because
of other projects I'm dreaming of ...

Thank you for your comments

Karl


Post a reply to this message

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