POV-Ray : Newsgroups : povray.general : report and question : Re: report and question Server Time
2 Nov 2024 17:20:39 EDT (-0400)
  Re: report and question  
From: Severi Salminen
Date: 21 Jan 2004 04:45:08
Message: <400e4a24@news.povray.org>
>   Like it is now it gives the impression that if you want to do
> something like that you'll need to copy-paste that #declare as
> many times as there are iterations, editing each one of them.
> The POV-Ray SDL is more powerful than this.
>   You can make an array (as large as the number of iterations),
> each item containing one iteration, and you can fill this array
> in a loop, each item using the previous one. Thus if you want
> to change the number of iterations it's enough to simply change
> one number (eg. a "#declare Iterations=6;" at the beginning).
> 

And I think Pov-Ray is even more powerful as even arrays are not needed 
in this. The easiest way to do it is probably (I changed a few translates):

#declare Initial = union {
    triangle { < 1,  1,  1>,  <-1,  1, -1>,  < 1, -1, -1> }
    triangle { <-1,  1, -1>,  <-1, -1,  1>,  < 1, -1, -1> }
    triangle { < 1,  1,  1>,  < 1, -1, -1>,  <-1, -1,  1> }
    triangle { < 1,  1,  1>,  <-1, -1,  1>,  <-1,  1, -1> }
}

#declare iter=5;
#declare Old=Initial;

#while(iter)
     #declare New =
     	union{
         	object { Old }
         	object { Old translate <-2, 0, 2> }
         	object { Old translate <-2, 2, 0> }
         	object { Old translate < 0, 2, 2> }
         	translate <1,-1,-1>
         	scale 0.5
     	}
     #declare Old=New;
     #declare iter=iter-1;
#end

object{New
     pigment {rgb 1}
}

Severi S.


Post a reply to this message

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