From b789f4fd993f8ac00da57f2b5cb3739d1ca261dc Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Wed, 26 Mar 2025 18:32:54 +1100 Subject: [PATCH] Now patterns in the bot version go all the way to the edges --- src/components/dots.js | 8 ++++---- src/index.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/dots.js b/src/components/dots.js index 3a066d3..5372353 100644 --- a/src/components/dots.js +++ b/src/components/dots.js @@ -38,8 +38,8 @@ function distance(dx, dy) { function int_range(v1, v2) { const vs = [v1, v2]; vs.sort((a, b) => a - b); - const low = Math.floor(vs[0]); - const high = Math.ceil(vs[1]); + const low = Math.floor(vs[0] - 1); + const high = Math.ceil(vs[1] + 1); return [...Array(high - low + 1).keys()].map((i) => i + low); } @@ -50,7 +50,7 @@ class DotMaker { this.cy = 0.5 * width; } - dots(m, n) { + dots(m, n, clip) { if( m - n === 0 ) { return []; } @@ -61,7 +61,7 @@ class DotMaker { js.map((j) => { const x = (j - m * i) / (m - n); const y = m * (x + i); - if( x > 0 && y > 0 && x < this.width && y < this.width ) { + if( !clip || (x > 0 && y > 0 && x < this.width && y < this.width) ) { ps.push({i:i, j:j, x:x, y:y}); } }); diff --git a/src/index.md b/src/index.md index df8d3ae..133451b 100644 --- a/src/index.md +++ b/src/index.md @@ -118,8 +118,8 @@ if( palette_fn ) { ```js -const dots1 = dm.dots(1 / m1, n1); -const dots2 = dm.dots(1 / m2, n2); +const dots1 = dm.dots(1 / m1, n1, true); +const dots2 = dm.dots(1 / m2, n2, true); ```