increase resolution of contoured lines
This commit is contained in:
parent
943b4e0d7c
commit
c3b061b421
2 changed files with 7 additions and 6 deletions
|
|
@ -1830,7 +1830,7 @@ class Polygon {
|
||||||
if (dl < max) {
|
if (dl < max) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const div = dl / dist;
|
const div = dl / max;
|
||||||
const fit = div | 0;
|
const fit = div | 0;
|
||||||
const add = fit - 1;
|
const add = fit - 1;
|
||||||
const ix = dx / fit;
|
const ix = dx / fit;
|
||||||
|
|
@ -1838,7 +1838,7 @@ class Polygon {
|
||||||
let ox = p1.x + ix;
|
let ox = p1.x + ix;
|
||||||
let oy = p1.y + iy;
|
let oy = p1.y + iy;
|
||||||
for (let i=0; i<add; i++) {
|
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;
|
ox += ix;
|
||||||
oy += iy;
|
oy += iy;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -958,7 +958,7 @@ class OpPocket extends CamOp {
|
||||||
|
|
||||||
slice(progress) {
|
slice(progress) {
|
||||||
const pocket = this;
|
const pocket = this;
|
||||||
const debug = true;
|
const debug = false;
|
||||||
let { op, state } = this;
|
let { op, state } = this;
|
||||||
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
|
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
|
||||||
let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state;
|
let { settings, widget, sliceAll, zMax, zTop, zThru, tabs, color } = state;
|
||||||
|
|
@ -1045,7 +1045,7 @@ class OpPocket extends CamOp {
|
||||||
}
|
}
|
||||||
POLY.setWinding(slice.camLines, cutdir, false);
|
POLY.setWinding(slice.camLines, cutdir, false);
|
||||||
if (contour) {
|
if (contour) {
|
||||||
pocket.conform(slice.camLines);
|
slice.camLines = pocket.conform(slice.camLines);
|
||||||
}
|
}
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer("pocket", {line: color}, false)
|
.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
|
// mold cam output lines to the surface of the topo offset by tool geometry
|
||||||
conform(camLines) {
|
conform(camLines) {
|
||||||
const topo = this.topo;
|
const topo = this.topo;
|
||||||
let repo = 10;
|
const hirez = camLines.map(p => p.segment(topo.tolerance * 2));
|
||||||
for (let poly of camLines) {
|
for (let poly of hirez) {
|
||||||
for (let point of poly.points) {
|
for (let point of poly.points) {
|
||||||
point.z = topo.toolAtXY(point.x, point.y);
|
point.z = topo.toolAtXY(point.x, point.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return hirez;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare(ops, progress) {
|
prepare(ops, progress) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue