hex_points = {
const ctx = DOM.context2d(width, height, 1)
const projection = d3.geoNaturalEarth1().fitWidth(width, {type: "Sphere"})
const path = d3.geoPath(projection, ctx)
const land = topojson.merge(world, world.objects.countries.geometries.filter(d => d.id !== "010"))
ctx.beginPath()
path(land)
const hex_width = SQRT3 * hex_radius
const hex_height = 2 * hex_radius
const map_columns = Math.ceil(width / hex_width)
const map_rows = Math.ceil((height - 0.5*hex_radius)/(1.5 * hex_radius))
let hex_points = []
for (let i = 0; i < map_rows; i++) {
for (let j = 0; j < map_columns; j++) {
let a
let b = (3 * i) * hex_radius / 2
if (i % 2 === 0) a = SQRT3 * j * hex_radius
else a = SQRT3 * (j - 0.5) * hex_radius
if (ctx.isPointInPath(a, b)) hex_points.push({x: a, y: b})
}
}
return hex_points
}