fix: drawCoastline - remove redundant off-canvas points

This commit is contained in:
max 2022-07-23 16:39:07 +03:00
parent ffea4d15cb
commit cc3c06f595
3 changed files with 8 additions and 22 deletions

View file

@ -9,7 +9,7 @@ export function drawCoastline(vertices: IGraphVertices, features: TPackFeatures)
const waterMask = defs.select("#water");
const lineGen = d3.line().curve(d3.curveBasisClosed);
const SIMPLIFICATION_TOLERANCE = 0.5; // px
const SIMPLIFICATION_TOLERANCE = 0.3; // px
// map edge rectangle
debug
@ -31,18 +31,6 @@ export function drawCoastline(vertices: IGraphVertices, features: TPackFeatures)
const simplifiedPoints = simplify(filteredPoints, SIMPLIFICATION_TOLERANCE);
const path = round(lineGen(simplifiedPoints)!);
points.forEach(([x, y]) => {
debug.append("circle").attr("cx", x).attr("cy", y).attr("r", 0.3).attr("fill", "red");
});
filteredPoints.forEach(([x, y]) => {
debug.append("circle").attr("cx", x).attr("cy", y).attr("r", 0.3).attr("fill", "blue");
});
simplifiedPoints.forEach(([x, y]) => {
debug.append("circle").attr("cx", x).attr("cy", y).attr("r", 0.3).attr("fill", "green");
});
if (feature.type === "lake") {
landMask
.append("path")