applications.collages.collageAlgebra:
{
  ntColour = const(.8),
  w = const(sqrt(1/8)),
  
  S = {
    filledPolygon((-.5,-.5),(.5,-.5),(.5,.5),(-.5,.5))[#ntColour,#ntColour,#ntColour],
    polygon((-.5,-.5),(.5,-.5),(.5,.5),(-.5,.5))
  },
  sq = {
    filledPolygon((0,0),(1,0),(1,-1),(0,-1))[#ntColour,#ntColour,#ntColour],
    polygon((0,0),(1,0),(1,-1),(0,-1))
  },
  D = #sq + { polyline((.95,0),(.95,-1)) width .1, polyline((1,-.95),(0,-.95)) width .1 },
  Da = #D + { filledPolygon((.4,-.3),(.5,-.25),(.6,-.3),(.5,-.1)), filledPolygon((.3,-.4),(.25,-.5),(.3,-.6),(.1,-.5)) },
  H = #sq + { polyline((.95,0),(.95,-1)) width .1 },
  Ha = #H + { filledPolygon((.4,-.7),(.5,-.75),(.6,-.7),(.5,-.9)) },
  Hb = #H + { filledPolygon((.4,-.3),(.5,-.25),(.6,-.3),(.5,-.1)) },
  Hab = #H + { filledPolygon((.4,-.7),(.5,-.75),(.6,-.7),(.5,-.9)), filledPolygon((.4,-.3),(.5,-.25),(.6,-.3),(.5,-.1)) },
  
  inner = {
    polyline((0,-1/4), (1/4,0), (3/4,-1/2)),
    polyline((3/4,0), (1,-1/4), (1/2, -3/4)),
    polyline((1,-3/4), (3/4, -1), (1/4, -1/2)),
    polyline((1/4,-1), (0,-3/4), (1/2,-1/4))
  },
  edge = {
    curve((0,-1/4), (1/4 - #w / 2, 0) left (0, -.175) ),
    curve((0,-3/4), (1/4, -1/2), (1/4 + #w / 2, 0) left (0, -.35)),
    curve((0,-3/4), (1/4 - #w / 2, -1) left (0, .175)),
    curve((1/4, -1/2), (1/4 + #w / 2, -1) left (0, .35))
  },
  edge2 = {
    curve(
      (0,-1/4),
      (1/4,0),
      (1/2,-1/4),
      (3/4 - #w / 2, -1/2) left (0, .175),
      (1/2,-3/4)),
    polyline((1/4,-1), (0,-3/4), (1/2,-1/4)),
    curve((3/4, 0), (3/4 + #w / 2, -1/2) left (0, .35), (3/4, -1), (1/4, -1/2))
  },
  edges = {
    curve(
      (1/4,-1),
      (1/4 - #w / 2, -1/2) right (0,.35),
      (1/4,0),
      (1/2,-1/4),
      (3/4 - #w / 2, -1/2) left (0, .175),
      (1/2,-3/4)),
    curve(
      (3/4, 0),
      (3/4 + #w / 2, -1/2) left (0, .35),
      (3/4, -1),
      (1/2, -3/4),
      (1/4 + #w / 2, -1/2) right (0, .175),
      (1/2, -1/4))
  },
  corner = {
    curve((0,-1/4 + #w / 2) right (.05,0), (1/4 - #w / 2,0) left (0,-.05)),
    polyline((0,-1/4 - #w / 2), (1/4 + #w / 2,-1/4 - #w / 2), (1/4 + #w / 2,0))
  },
  corner2 = {
    curve(
      (0,-1/4),
      (1/4,0),
      (1/2,-1/4),
      (3/4 - #w / 2, -1/2) left (0, .175) right (0,-.05),
      (1/2, -3/4 + #w / 2) left (.05,0) right (-.175, 0),
      (1/4, -1/2)),
    curve(
      (3/4, 0),
      (3/4 + #w / 2, -1/2) left (0, .35) right (0,0),
      (3/4 + #w / 2, -3/4 - #w / 2),
      (1/2, -3/4 - #w / 2) left (0,0) right (-.35, 0),
      (0, -3/4),
      (1/2, -1/4)
    )
  },
  
  id = scale(1),
  d = translate(1,-1),
  v = translate(0,1) . rotate(-90) . translate(0,-1),
  h = translate(1,0),
  
  d = <id, v, h, d>,
  h = <id, h>,
  
  q1 = rotate(90),
  q2 = rotate(180),
  q3 = rotate(270),
  q = <id, q1, q2, q3>,
  
  rot90 = rotate(90) . translate(0,-1),
  rot90 = <rot90>,
  
  rot180 = rotate(180) . translate(1,-1),
  rot180 = <rot180>,
  
  rot270 = rotate(270) . translate(1,0),
  rot270 = <rot270>
  
}
