landPaths = {
let japan_simplified = topojson.presimplify(japan);
let min_weight = topojson.quantile(japan_simplified, quantileValue);
japan_simplified = topojson.simplify(japan_simplified, min_weight);
let land_simplified = topojson.merge(
japan_simplified,
japan_simplified.objects["prefectures"].geometries
);
const svgPath = path(land_simplified).split("M");
svgPath.shift();
let land_rounded = [];
svgPath.forEach((d) => {
land_rounded.push(
d
.replace(/Z/, "")
.split("L")
.map((p) => p.split(","))
);
});
function curvedPath(land, curveFunc) {
const line = d3
.line()
.x((d) => d[0])
.y((d) => d[1])
.curve(curveFunc);
return land.map((d) => line(d));
}
const landPaths = {
無し: path(land_simplified),
curveBasisClosed: curvedPath(land_rounded, d3.curveBasisClosed),
curveCatmullRomClosed: curvedPath(land_rounded, d3.curveCatmullRomClosed),
curveNatural: curvedPath(land_rounded, d3.curveNatural)
};
return landPaths;
}