applications.collages.collageAlgebra:
  {
    height = const(sqrt(3)/2),
   
    background = { filledPolygon((0,#height), (.5,0), (-.5,0)) },
    
    partsA = {
               curve((.1, #height - .1 - .1 / .5 * cos(30)),
                     (0, #height - .1),
                     (-.5 + .1 * cos(30), .1 * .5) left (0,0) right (.05,0),
                     (-.25, .08) left (-.065, -.03)) width .06,
               curve((-.1, .17) right (.04, .03),
                     (-.03, .24) left (-.025, -.03)) width .06,
               curve((.035, .47 * #height) right (.03, .12),
                     (.028, #height - .26) left (.02, -.04)) width .06,
               curve((.028, #height - .26) right (-.006, .012),
                     (0, #height - .225),
                     (-.028, #height - .26) left (.006, .012)
                    ) width .06,
               curve((-.25 + .065, #height / 2 - .05) right (.024, -.02),
                     (-.085,.25) left (-.03, .05)) width .06,
               curve((-.025, .13) right (.03, -.05),
                     (.07, .08) left (-.01, 0)) width .06,
               curve((.18, .25) right (0, .1),
                     (.13, .41) left (.015, -.02)) width .06,
                     
               curve((.1, #height - .1 - .1 / .5 * cos(30)),
                     (0, #height - .1),
                     (-.5 + .1 * cos(30), .1 * .5) left (0,0) right (.05,0),
                     (-.25, .08) left (-.065, -.03))[1] width .03,
               curve((-.1, .17) right (.04, .03),
                     (-.03, .24) left (-.025, -.03))[1] width .03,
               curve((.035, .47 * #height) right (.03, .12),
                     (.028, #height - .26) left (.02, -.04))[1] width .03,
               curve((.028, #height - .26) right (-.006, .012),
                     (0, #height - .225),
                     (-.028, #height - .26) left (.006, .012)
                    )[1] width .03,
               curve((-.25 + .065, #height / 2 - .05) right (.024, -.02),
                     (-.085,.25) left (-.03, .05))[1] width .03,
               curve((-.025, .13) right (.03, -.05),
                     (.07, .08) left (-.01, 0))[1] width .03,
               curve((.18, .25) right (0, .1),
                     (.13, .41) left (.015, -.02))[1] width .03
             },
    
    partsB = { 
               curve((-.25, .08) right (.065, .03),
                     (-.1, .17) left (-.04, -.03)) width .06,
               curve((-.03, .24) right (.025, .03),
                     (.035, .47 * #height) left (-.01, -.04)) width .06,
               curve((-.25, #height / 2) right (.03 * cos(30), -.03 * .5),
                     (-.25 + .065, #height / 2 - .05) left (-.024, .02)
                    ) width .06,
               curve((-.085,.25) right (.03, -.05),
                     (-.025, .13) left (-.03, .05)) width .06,
               curve((.07, .08) right (.05, 0),
                     (.18, .25) left (0, -.1)) width .06,
               curve((.13, .41) right (-.015, .02),
                     (0, .465) left (.075, 0)) width .06,
                     
               curve((-.25, .08) right (.065, .03),
                     (-.1, .17) left (-.04, -.03))[1] width .03,
               curve((-.03, .24) right (.025, .03),
                     (.035, .47 * #height) left (-.01, -.04))[1] width .03,
               curve((-.25, #height / 2) right (.03 * cos(30), -.03 * .5),
                     (-.25 + .065, #height / 2 - .05) left (-.024, .02)
                    )[1] width .03,
               curve((-.085,.25) right (.03, -.05),
                     (-.025, .13) left (-.03, .05))[1] width .03,
               curve((.07, .08) right (.05, 0),
                     (.18, .25) left (0, -.1))[1] width .03,
               curve((.13, .41) right (-.015, .02),
                     (0, .465) left (.075, 0))[1] width .03
             },
    
    partsA2 = {
               curve((.1, #height - .1 - .1 / .5 * cos(30)),
                     (0, #height - .1),
                     (-.5 + .1 * cos(30), .1 * .5) left (0,0) right (.05,0),
                     (-.25, .08) left (-.065, -.03)) width .06,
               curve((-.1, .17) right (.04, .03),
                     (-.03, .24) left (-.025, -.03)) width .06,
               curve((.035, .47 * #height) right (.03, .12),
                     (.028, #height - .26) left (.02, -.04)) width .06,
               curve((.028, #height - .26) right (-.006, .012),
                     (0, #height - .225),
                     (-.028, #height - .26) left (.006, .012)
                    ) width .06,
               curve((-.25 + .065, #height / 2 - .05) right (.024, -.02),
                     (-.085,.25) left (-.03, .05)) width .06,
               curve((-.025, .13) right (.03, -.05),
                     (.03, .05) left (-.02, .025)) width .06,
               polyline((.03, -.05),
                     (.11, .05)) width .06,
               curve((.18, .25) right (0, .1),
                     (.13, .41) left (.015, -.02)) width .06,
                     
               curve((.1, #height - .1 - .1 / .5 * cos(30)),
                     (0, #height - .1),
                     (-.5 + .1 * cos(30), .1 * .5) left (0,0) right (.05,0),
                     (-.25, .08) left (-.065, -.03))[1] width .03,
               curve((-.1, .17) right (.04, .03),
                     (-.03, .24) left (-.025, -.03))[1] width .03,
               curve((.035, .47 * #height) right (.03, .12),
                     (.028, #height - .26) left (.02, -.04))[1] width .03,
               curve((.028, #height - .26) right (-.006, .012),
                     (0, #height - .225),
                     (-.028, #height - .26) left (.006, .012)
                    )[1] width .03,
               curve((-.25 + .065, #height / 2 - .05) right (.024, -.02),
                     (-.085,.25) left (-.03, .05))[1] width .03,
               curve((-.025, .13) right (.03, -.05),
                     (.03, .05) left (-.02, .025))[1] width .03,
               polyline((.03, -.05),
                     (.11, .05))[1] width .03,
               curve((.18, .25) right (0, .1),
                     (.13, .41) left (.015, -.02))[1] width .03
             },
    
    partsB2 = { 
               curve((-.25, .08) right (.065, .03),
                     (-.1, .17) left (-.04, -.03)) width .06,
               curve((-.03, .24) right (.025, .03),
                     (.035, .47 * #height) left (-.01, -.04)) width .06,
               curve((-.25, #height / 2) right (.03 * cos(30), -.03 * .5),
                     (-.25 + .065, #height / 2 - .05) left (-.024, .02)
                    ) width .06,
               curve((-.085,.25) right (.03, -.05),
                     (-.025, .13) left (-.03, .05)) width .06,
               polyline((.03, .05),
                     (.11, -.05))  width .06,
               curve((.11, .05) right (.02, .025),
                     (.18, .25) left (0, -.07)) width .06,
               curve((.13, .41) right (-.015, .02),
                     (0, .465) left (.075, 0)) width .06,
                     
               curve((-.25, .08) right (.065, .03),
                     (-.1, .17) left (-.04, -.03))[1] width .03,
               curve((-.03, .24) right (.025, .03),
                     (.035, .47 * #height) left (-.01, -.04))[1] width .03,
               curve((-.25, #height / 2) right (.03 * cos(30), -.03 * .5),
                     (-.25 + .065, #height / 2 - .05) left (-.024, .02)
                    )[1] width .03,
               curve((-.085,.25) right (.03, -.05),
                     (-.025, .13) left (-.03, .05))[1] width .03,
               polyline((.03, .05),
                     (.11, -.05))[1] width .03,
               curve((.11, .05) right (.02, .025),
                     (.18, .25) left (0, -.07))[1] width .03,
               curve((.13, .41) right (-.015, .02),
                     (0, .465) left (.075, 0))[1] width .03
             },
    
    mirY = scale(-1,1),
    mirX = scale(1,-1),
             
    tile1 = #background +
        #partsA +
        #partsB transformed by mirY +
        #partsA transformed by mirY +
        #partsB,
    tile2 = #background +
        #partsA2 +
        #partsB2 transformed by mirY +
        #partsA2 transformed by mirY +
        #partsB2,
    
    id = translate(0,0),
    
    up1 = translate(-.5, #height),
    up2 = translate(0, 2 * #height),
    up3 = translate(.5, #height),
    up = <id,up1,up2,up3>,
    
    up-left = use(mirY) . translate(-.5, #height),
    up-left = <mirY,up-left>,
    
    up-right = use(mirY) . translate(.5, #height),
    up-right = <mirY,up-right>,
    
    combine1 = translate(0, #height),
    combine2 = rotate(180) . translate(0, #height),
    combine = <combine1,combine2>,
    
    hex1 = rotate(60),
    hex2 = rotate(120),
    hex3 = rotate(180),
    hex4 = rotate(240),
    hex5 = rotate(300),
    hex = <id,hex1,hex2,hex3,hex4,hex5> ,
    
    S = {
          filledPolygon((0,0), (.5,#height), (-.5,#height))[.5,0,0],
          polygon((0,0), (.5,#height), (-.5,#height))
        },
    L = {
          filledPolygon((0,0), (.5,#height), (-.5,#height))[0,.5,0],
          polygon((0,0), (.5,#height), (-.5,#height))
        },
    R = {
          filledPolygon((0,0), (.5,#height), (-.5,#height))[0,0,.5],
          polygon((0,0), (.5,#height), (-.5,#height))
        },
    WAIT = {
          filledPolygon((0,#height), (.5,0), (-.5,0))[.5,.5,.5],
          polygon((0,#height), (.5,0), (-.5,0))
        }
  }
