3d/geometrie/menger/menger.pov

83 lines
1.2 KiB
POVRay

#include "colors.inc"
#include "glass.inc"
#declare Eps = 1E-6;
#macro menger_level(C1, C2, Lev)
#if (Lev > 0)
#local dx = 0;
#while (dx < 3)
#local dy = 0;
#while (dy < 3)
#local dz = 0;
#while (dz < 3)
#if ((dx = 1) + (dy = 1) + (dz = 1) < 2)
menger_level(<C1.x + (C2.x - C1.x)*dx/3,
C1.y + (C2.y - C1.y)*dy/3,
C1.z + (C2.z - C1.z)*dz/3>,
<C1.x + (C2.x - C1.x)*(dx+1)/3,
C1.y + (C2.y - C1.y)*(dy+1)/3,
C1.z + (C2.z - C1.z)*(dz+1)/3>,
Lev-1)
#end
#local dz = dz + 1;
#end
#local dy = dy + 1;
#end
#local dx = dx + 1;
#end
#else
box {
C1 + Eps, C2 - Eps
}
#end
#end
union {
menger_level(<-1, -1, -1>, <1, 1, 1>, 4)
// texture { pigment { color rgb <1, 1, 1> }}
texture {T_Old_Glass }
interior {
ior 1.5
caustics 1.0
}
}
global_settings {
assumed_gamma 1.0
ambient_light rgb<0.5, 0.5, 0.5>
max_trace_level 10
}
light_source {
<2000, 3000, 1000>
color White
}
camera {
location <4, 6, 3>
look_at <0, 0, 0>
angle 40
}
plane {
<0, 1, 0>, -1
pigment {
hexagon
pigment { color Red }
pigment { color Green }
pigment { color Blue }
scale 0.1
}
}