dotspace = 0.2

define dot {
  circle filled 1 rad 0.02 at ($1, $2)
}

define lattice {
  for i = 0 to (($1-1)*dotspace) by dotspace do {
    for j = 0 to (($2-1)*dotspace) by dotspace do {
      dot(i, j);
    }
  }
}

define tri {
  A: $1
  B: $2
  C: $3
  line thickness 0 from (A.x * dotspace, A.y * dotspace) to (B.x * dotspace, B.y * dotspace)
  line thickness 0 from (A.x * dotspace, A.y * dotspace) to (C.x * dotspace, C.y * dotspace)
  line thickness 0 from (C.x * dotspace, C.y * dotspace) to (B.x * dotspace, B.y * dotspace)
}

define quad {
  A: $1
  B: $2
  C: $3
  D: $4
  line thickness 0 from (A.x * dotspace, A.y * dotspace) to (B.x * dotspace, B.y * dotspace)
  line thickness 0 from (B.x * dotspace, B.y * dotspace) to (C.x * dotspace, C.y * dotspace)
  line thickness 0 from (C.x * dotspace, C.y * dotspace) to (D.x * dotspace, D.y * dotspace)
  line thickness 0 from (D.x * dotspace, D.y * dotspace) to (A.x * dotspace, A.y * dotspace)
}

define dquad {
  A: $1
  B: $2
  C: $3
  D: $4
  line dotted thickness 0 from (A.x * dotspace, A.y * dotspace) to (B.x * dotspace, B.y * dotspace)
  line dotted thickness 0 from (B.x * dotspace, B.y * dotspace) to (C.x * dotspace, C.y * dotspace)
  line dotted thickness 0 from (C.x * dotspace, C.y * dotspace) to (D.x * dotspace, D.y * dotspace)
  line dotted thickness 0 from (D.x * dotspace, D.y * dotspace) to (A.x * dotspace, A.y * dotspace)
}

define dsq {
  dquad(($1-.5, $2-.5), ($1-.5, $2+.5), ($1+.5, $2+.5), ($1+.5, $2-.5));
}


define pent {
  A: $1
  B: $2
  C: $3
  D: $4
  E: $5
  line thickness 0 from (A.x * dotspace, A.y * dotspace) to (B.x * dotspace, B.y * dotspace)
  line thickness 0 from (B.x * dotspace, B.y * dotspace) to (C.x * dotspace, C.y * dotspace)
  line thickness 0 from (C.x * dotspace, C.y * dotspace) to (D.x * dotspace, D.y * dotspace)
  line thickness 0 from (D.x * dotspace, D.y * dotspace) to (E.x * dotspace, E.y * dotspace)
  line thickness 0 from (E.x * dotspace, E.y * dotspace) to (A.x * dotspace, A.y * dotspace)
}

define label {
  A: $2
  $1 at (A.x * dotspace, A.y * dotspace)
}