From df72bb89962a0283e99451981f7f6caa6104c32b Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 23 Dec 2025 10:36:33 -0500 Subject: [PATCH 1/3] fix use of flatness to drop points in cpu contour --- src/kiri/mode/cam/topo3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kiri/mode/cam/topo3.js b/src/kiri/mode/cam/topo3.js index 7668dd18..460881bb 100644 --- a/src/kiri/mode/cam/topo3.js +++ b/src/kiri/mode/cam/topo3.js @@ -725,7 +725,7 @@ export class Trace { const slope = Math.atan2(dz, dl); if (curvesOnly && Math.abs(dz) < flatness) { end_poly(newP); - } else if (lastSlope !== undefined && Math.abs(lastSlope - slope) < 0.001) { + } else if (lastSlope !== undefined && Math.abs(lastSlope - slope) < flatness) { latent = newP; } else { if (latent) { From 15acdcfcbad9fd350cc99a9cd8638241d8da5f96 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 23 Dec 2025 10:39:36 -0500 Subject: [PATCH 2/3] fix use of flatness to drop points in gpu contour --- src/kiri/mode/cam/topo3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kiri/mode/cam/topo3.js b/src/kiri/mode/cam/topo3.js index 460881bb..3910268d 100644 --- a/src/kiri/mode/cam/topo3.js +++ b/src/kiri/mode/cam/topo3.js @@ -252,11 +252,11 @@ export class Topo { for (let i=2; i epsilon) { + if (Math.abs(dz - ndz) > flatness) { // slope changed merged.push(lp); dz = ndz; - } else if (curvesOnly && Math.abs(ndz) < epsilon) { + } else if (curvesOnly && Math.abs(ndz) < flatness) { // add empty points as path separators merged.push(undefined); } From 55f261d3be73076d12337ff85313009f148dc1f5 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 23 Dec 2025 10:52:02 -0500 Subject: [PATCH 3/3] add gpu contouring comments --- src/kiri/mode/cam/topo3.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/kiri/mode/cam/topo3.js b/src/kiri/mode/cam/topo3.js index 3910268d..1253cdf1 100644 --- a/src/kiri/mode/cam/topo3.js +++ b/src/kiri/mode/cam/topo3.js @@ -126,9 +126,8 @@ export class Topo { wbounds.expandByVector({ x: toolDiameter/2 + resolution, y: toolDiameter/2 + resolution, z: 0 }); } + // swap XY vertices (unswap later after polylines generated) if (contourY) { - // console.time('swap XY vertices'); - // swap XY vertices for (let i=0; i 1) { lines.push(poly); @@ -200,6 +206,7 @@ export class Topo { skip = 0; continue; } + // off part but we want to return zBottom (outside) if (p.z < zBottom - epsilon) { lp = p; if (poly.length === 0) { @@ -215,6 +222,7 @@ export class Topo { continue; } } else if (lp && skip && poly.length === 0) { + // latent/last point output lp.z = zBottom; poly.push(lp); } @@ -225,6 +233,7 @@ export class Topo { if (poly.length > 1) { lines.push(poly); } + // fixup/swap when contouring along Y if (contourY) { for (let poly of lines) for (let p of poly.points) {