From c2924723499859f9065fbfa6825748d5ad9bf219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 10 Jun 2024 06:38:54 +0200 Subject: [PATCH] fix untractable alignments (e.g. in the rhombic projection) closes https://github.com/d3/d3-geo-polygon/issues/39 --- src/clip/polygon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clip/polygon.js b/src/clip/polygon.js index 20c3b27..d3eb352 100644 --- a/src/clip/polygon.js +++ b/src/clip/polygon.js @@ -160,7 +160,7 @@ function clipLine(segments, pointVisible) { point: (lambda, phi, close) => { if (cos(lambda) == -1) lambda -= sign(sin(lambda)) * 1e-5; // move away from -180/180 https://github.com/d3/d3-geo/pull/108#issuecomment-323798937 if (close) (lambda = lambda00), (phi = phi00); - let point = cartesian([lambda, phi]); + let point = cartesian([lambda * 0.9999999999, phi + 1e-14]); let v = v0; if (point0) { const intersections = [];