In [1]:
using Compose3D


50.0
(Length{:mm}(50.0),Length{:mm}(30.0),Length{:mm}(0.0))
BoundingBox{3,Length{:mm},Length{:mm}}(Point
{3,Length{:mm}}((Length{:mm}(25.0),Length{:mm}(15.0),Length{:mm}(0.0))),(Length{:mm}(50.0),Length{:mm}(30.0),Length{:mm}(0.0)))
34.0
(Length{:mm}(50.0),Length{:mm}(30.0),Length{:mm}(20.0))
BoundingBox{3,Length{:mm},Length{:mm}}(Point{3,Length{:mm}}((Length{:mm}(25.0),Length{:mm}(10.0),Length{:mm}(15.0))),(Length{:mm}(50.0),Length{:mm}(20.0),Length{:mm}(30.0)))
BoundingBox{3,Length{:mm},Length{:mm}}(Point{3,Length{:mm}}((Length{:mm}(0.0),Length{:mm}(0.0),Length{:mm}(0.0))),(Length{:mm}(100.0),Length{:mm}(60.0),Length{:mm}(40.0)))

In [2]:
cb = cube(0mm,0mm,0mm,1mm)
cb2 = cube(0mm,10mm,0mm,1mm)
cb3 = cube(0mm,0mm,0mm,1mm)


Out[2]:
Geometry{CubePrimitive}([CubePrimitive(Point{3,Length{:mm}}((Length{:mm}(0.0),Length{:mm}(0.0),Length{:mm}(0.0))),Length{:mm}(1.0))])

In [3]:
sp1 = sphere(-5mm,0mm,0mm,1mm)


Out[3]:
Geometry{SpherePrimitive}([SpherePrimitive(Point{3,Length{:mm}}((Length{:mm}(-5.0),Length{:mm}(0.0),Length{:mm}(0.0))),Length{:mm}(1.0))])

In [4]:
py1 = pyramid(0mm,0mm,0mm,2mm,4mm)


Out[4]:
Geometry{PyramidPrimitive}([PyramidPrimitive(Point{3,Length{:mm}}((Length{:mm}(0.0),Length{:mm}(0.0),Length{:mm}(0.0))),Length{:mm}(2.0),Length{:mm}(4.0))])

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]:
Geometry{PyramidPrimitive}([PyramidPrimitive(Point{3,Length{:mm}}((Length{:mm}(0.0),Length{:mm}(0.0),Length{:mm}(0.0))),Length{:mm}(1.0),Length{:mm}(1.0))])

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 [ ]: