increase resolution of contoured lines

This commit is contained in:
Stewart Allen 2022-10-10 11:54:51 -04:00
commit c3b061b421
2 changed files with 7 additions and 6 deletions

View file

@ -1830,7 +1830,7 @@ class Polygon {
if (dl < max) {
continue;
}
const div = dl / dist;
const div = dl / max;
const fit = div | 0;
const add = fit - 1;
const ix = dx / fit;
@ -1838,7 +1838,7 @@ class Polygon {
let ox = p1.x + ix;
let oy = p1.y + iy;
for (let i=0; i<add; i++) {
newp.push(new Point(undefined, ox, oy));
newp.push(newPoint(ox, oy, (p1.z + p2.z) / 2));
ox += ix;
oy += iy;
}

View file

@ -958,7 +958,7 @@ class OpPocket extends CamOp {
slice(progress) {
const pocket = this;
const debug = true;
const debug = false;
let { op, state } = this;
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state;
@ -1045,7 +1045,7 @@ class OpPocket extends CamOp {
}
POLY.setWinding(slice.camLines, cutdir, false);
if (contour) {
pocket.conform(slice.camLines);
slice.camLines = pocket.conform(slice.camLines);
}
slice.output()
.setLayer("pocket", {line: color}, false)
@ -1095,12 +1095,13 @@ class OpPocket extends CamOp {
// mold cam output lines to the surface of the topo offset by tool geometry
conform(camLines) {
const topo = this.topo;
let repo = 10;
for (let poly of camLines) {
const hirez = camLines.map(p => p.segment(topo.tolerance * 2));
for (let poly of hirez) {
for (let point of poly.points) {
point.z = topo.toolAtXY(point.x, point.y);
}
}
return hirez;
}
prepare(ops, progress) {