function makeSupercluster(type, pt, r, level) {
if (level == 0) {
return makeCluster(type, pt, r);
}
const c1 = makeSupercluster('Γ', pt, 11 - r, level - 1);
const c2 = makeSupercluster(TILE6[type][0], c1.control_points[1], 3 - r, level - 1);
translate(c2.control_points[1], c1.control_points[1], c2);
const c3 = makeSupercluster(TILE7[type], c1.control_points[2], 7 - r, level - 1);
translate(c3.control_points[2], c1.control_points[2], c3);
const c4 = makeSupercluster('Δ', c3.control_points[1], 9 - r, level - 1);
translate(c4.control_points[3], c3.control_points[1], c4);
const c5 = makeSupercluster(type == 'Γ' ? 'Ξ' : TILE9[type], c4.control_points[0], 9 - r, level - 1);
translate(c5.control_points[2], c4.control_points[0], c5);
const c6 = makeSupercluster(TILE1[type][0], c5.control_points[1], 11 - r, level - 1);
translate(c6.control_points[3], c5.control_points[1], c6);
const c7 = makeSupercluster('Σ', c6.control_points[1], 1 - r, level - 1);
translate(c7.control_points[3], c6.control_points[1], c7);
const c8 = makeSupercluster(TILE3[type], c7.control_points[0], 1 - r, level - 1);
translate(c8.control_points[2], c7.control_points[0], c8);
let tiles = c1.tiles.concat(
c2.tiles, c3.tiles, c4.tiles, c6.tiles, c7.tiles, c8.tiles,
);
if (type != 'Γ') {
tiles = tiles.concat(c5.tiles);
}
return {
control_points: [
c6.control_points[0],
c3.control_points[3],
c2.control_points[0],
c8.control_points[3],
],
tiles
};
}