function genArcTile(ctx, poly, connections, thick) {
let tileCenter = Vec(0, 0);
for (let p of poly) tileCenter = tileCenter.add(p);
tileCenter = tileCenter.scale(1 / poly.length);
for (let con of connections) {
if (con.length == 2) {
let [i, j] = con;
let [a, b] = [poly[i], poly[(i + 1) % poly.length]];
let [c, d] = [poly[j], poly[(j + 1) % poly.length]];
ctx.beginPath();
genArcPath(ctx, a, b, c, d, 0.5 - thick / 2);
genArcPath(ctx, c, d, a, b, 0.5 - thick / 2);
ctx.fill();
ctx.beginPath();
genArcPath(ctx, a, b, c, d, 0.5 - thick / 2);
ctx.stroke();
ctx.beginPath();
genArcPath(ctx, c, d, a, b, 0.5 - thick / 2);
ctx.stroke();
} else {
let i = con[0];
let [a, b, ref] = [
poly[i],
poly[(i + 1) % poly.length],
poly[(i + 2) % poly.length]
];
ctx.beginPath();
genPathEnd(ctx, a, b, ref, thick);
ctx.fill();
ctx.stroke();
}
}
}