applications.collages.collageAlgebra:
  {
    ntColour = const(.8),
    a = const(sin(22.5)),
    b = const(cos(22.5)),
    s = const(.5),
  
    tile = { polygon((-#a,#b),(-#b,#a),(-#b,-#a),(-#a,-#b),(#a,-#b),(#b,-#a),(#b,#a),(#a,#b)) },
    tile2 = { polygon((-#a * #s, #b * #s),(#a * #s, #b * #s),(#a, #b),(-#a, #b)) },
    tile3 = { polygon((0,0),(1,0),(.5,1)) },
    
    sample-filled = { filledPolygon((-1,-1),(1,-1),(1,1),(-1,1))[#ntColour,#ntColour,#ntColour] },
    sample-arrow = { filledPolygon((-1,-1), (-1.1,-.7), (-.9,-.7)) },
    sample-reduction = scale(.8),
    S = #sample-filled + #tile +
        #tile transformed by sample-reduction +
        #sample-arrow transformed by sample-reduction,
    
    r1 = scale(#s),
    r2 = scale(1),
    r3 = rotate(45),
    r4 = rotate(90),
    r5 = rotate(135),
    r6 = rotate(180),
    r7 = rotate(225),
    r8 = rotate(270),
    r9 = rotate(315),
    refine = < r1, r2, r3, r4, r5, r6, r7, r8, r9 >,
    
    s1 = map((0,0) -> (0, #b), (1,0) -> (-#a, #b), (.5,1) -> (-#a * #s, #b * #s)),
    s2 = map((0,0) -> (-#a * #s, #b * #s), (1,0) -> (#a * #s, #b * #s), (.5,1) -> (0,#b)),
    s3 = map((0,0) -> (#a, #b), (1,0) -> (0, #b), (.5,1) -> (#a * #s, #b * #s)),
    refine2 = < s1, s2, s3>,
    
    t1 = map((0,0) -> (0, 0), (1,0) -> (1/3, 0), (.5,1) -> (.5,1)),
    t2 = map((0,0) -> (1/3, 0), (1,0) -> (2/3, 0), (.5,1) -> (.5,1)),
    t3 = map((0,0) -> (2/3, 0), (1,0) -> (1, 0), (.5,1) -> (.5,1)),
    refine3 = <t1, t2, t3>,
    
    invert = scale(1/#s),
    invert = <invert>
    
  }
