diff --git a/src/mode/cam/topo.js b/src/mode/cam/topo.js index b1506a44..be4907f8 100644 --- a/src/mode/cam/topo.js +++ b/src/mode/cam/topo.js @@ -9,8 +9,10 @@ CAM = KIRI.driver.CAM, PRO = CAM.process, POLY = BASE.polygons, + RAD2DEG = 180 / Math.PI, newSlice = KIRI.newSlice, newLine = BASE.newLine, + newSlope = BASE.newSlope, newPoint = BASE.newPoint, newPolygon = BASE.newPolygon, noop = function() {}; @@ -145,6 +147,17 @@ newtrace.push(latent); latent = null; } + if (curvesOnly && lastP) { + // maxangle + const dz = Math.abs(lastP.z - z); + const dxy = Math.max(Math.abs(lastP.x - x), Math.abs(lastP.y - y)); + const angle = Math.atan2(dz, dxy) * RAD2DEG; + // if (lastP.z < 0.1) console.log('pp', {dz, dxy, angle}); + if (angle > maxangle) { + lastP = newP; + return; + } + } newtrace.push(newP); } lastP = newP;