Rekursiver Würfel mit PovRay

Der Raytracer PovRay erlaubt das Definieren rekursiver Strukturen:
#version 3.7;
#include "colors.inc"
#include "stones.inc"
#include "math.inc"

global_settings { assumed_gamma 1 }

camera
{
   location <6,6,-6>
   right image_width/image_height*x
   look_at <0.5,0.5,0.5>
   angle 13
} 

light_source { <+0,+4,-4> 1}
light_source { <+4,+2,-1> 1}
light_source { <0.5,0.5,0.5> 0.5}    

object { plane  { <0,1,0> 0 } pigment { checker color rgb <0.8,0.8,0.8>, color rgb <0.6,0.6,0.6> } }

#local F = sqrt(2)-1;
#local G = 1 - 2 * F;

#macro KUBUS(n,s)
   #if (n<=0) box{<0,0,0><s,s,s>}
   #else
      #local s1 = s*F;
      #local p1 = s*(1-F); 
      #local s2 = s1*F;
      #local p2 = s - s2;
      union
      {
         #for(X,0,1) #for(Z,0,1)
            #for(Y,0,1) object { KUBUS(n-1,s1) translate<X*p1,Y*p1,Z*p1> } #end
            object { KUBUS(n-2,s2) translate<s1  ,Z*p2,X*p2> }
            object { KUBUS(n-2,s2) translate<X*p2,Z*p2,s1  > }
            object { KUBUS(n-2,s2) translate<X*p2,s1  ,Z*p2> }
         #end #end
      }    
   #end
#end

object { KUBUS(5,1) texture { T_Stone13 } }

KUBUS(0,1)

KUBUS(1,1)

KUBUS(2,1)

KUBUS(3,1)

KUBUS(4,1)

KUBUS(5,1)

KUBUS(6,1)