In [1]:
using Compose3D
In [2]:
cb = cube(0mm,0mm,0mm,1mm)
cb2 = cube(0mm,10mm,0mm,1mm)
cb3 = cube(0mm,0mm,0mm,1mm)
Out[2]:
In [3]:
sp1 = sphere(-5mm,0mm,0mm,1mm)
Out[3]:
In [4]:
py1 = pyramid(0mm,0mm,0mm,2mm,4mm)
Out[4]:
In [5]:
ct = Context(0mm,0mm,0mm,100mm,100mm,100mm)
ct2 = Context(-20mm,-10mm,0mm,50mm,50mm,50mm)
Out[5]:
In [6]:
compose1 = compose(ct,py1)
Out[6]:
In [7]:
compose2 = compose(compose1,cb2)
Out[7]:
In [11]:
compose3 = compose(ct2, cb3)
Out[11]:
In [12]:
compose4 = compose(compose2,compose3, sphere(5mm,5mm,0mm,2mm))
Out[12]:
In [16]:
py1 = pyramid(0mm,0mm,0mm,1mm,1mm)
Out[16]:
In [17]:
function sierpinski(n)
if n == 0
compose(Context(0w,0h,0d,1w,1h,1d),pyramid(0w,0h,0d,1w,1h))
else
t = sierpinski(n - 1)
compose(Context(0w,0h,0d,1w,1h,1d),
(Context(0w,0h,0d,(1/2)w,(1/2)h,(1/2)d), t),
(Context(0.5w,0h,0d,(1/2)w,(1/2)h,(1/2)d), t),
(Context(0.5w,0.5h,0d,(1/2)w,(1/2)h,(1/2)d), t),
(Context(0w,0.5h,0d,(1/2)w,(1/2)h,(1/2)d), t),
(Context(0.25w,0.25h,0.5d,(1/2)w,(1/2)h,(1/2)d), t))
end
end
compose(Context(-5mm,-5mm,-5mm,10mm,10mm,10mm),sierpinski(4))
Out[17]:
In [15]:
In [ ]: