From 73434f5bb717a8261e57ed9728cb8569ec3b1974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20M=C3=A9sz=C3=A1ros=2C=20Ph=2ED?= Date: Mon, 18 Apr 2022 21:43:25 +0200 Subject: [PATCH] fix exact multiple error for spacing (#776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mészáros Gergely --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index f9146b6f..fc424222 100644 --- a/main.js +++ b/main.js @@ -760,8 +760,8 @@ function placePoints() { const spacing = (grid.spacing = rn(Math.sqrt((graphWidth * graphHeight) / cellsDesired), 2)); // spacing between points before jirrering grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing); grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid - grid.cellsX = Math.floor((graphWidth + 0.5 * spacing) / spacing); - grid.cellsY = Math.floor((graphHeight + 0.5 * spacing) / spacing); + grid.cellsX = Math.floor((graphWidth + 0.5 * spacing - 1e-10) / spacing); + grid.cellsY = Math.floor((graphHeight + 0.5 * spacing - 1e-10) / spacing); TIME && console.timeEnd("placePoints"); }