mock up basic thinwall w/out medial axis
This commit is contained in:
parent
457c03766c
commit
f8180fe79a
2 changed files with 37 additions and 4 deletions
|
|
@ -138,16 +138,17 @@ class Print {
|
|||
}
|
||||
|
||||
poly.forEachPoint((point, pos, points, count) => {
|
||||
if (first) {
|
||||
if (options.onfirst) {
|
||||
if (first || point.skip) {
|
||||
// if (point.skip) console.log({ skip: point });
|
||||
if (first && options.onfirst) {
|
||||
options.onfirst(point);
|
||||
}
|
||||
// move to first output point on poly
|
||||
let out = scope.addOutput(output, point, 0, moveSpeed, tool);
|
||||
if (options.onfirstout) {
|
||||
if (first && options.onfirstout) {
|
||||
options.onfirstout(out);
|
||||
}
|
||||
first = false;
|
||||
if (first) first = false;
|
||||
} else {
|
||||
let seglen = last.distTo2D(point);
|
||||
if (coastDist && shellMult && perimeter - seglen <= coastDist) {
|
||||
|
|
@ -158,6 +159,7 @@ class Print {
|
|||
shellMult = 0;
|
||||
}
|
||||
perimeter -= seglen;
|
||||
// to increase shellMult when point.inc set for collapsed points
|
||||
scope.addOutput(output, point, shellMult, printSpeed, tool);
|
||||
}
|
||||
last = point;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,37 @@ function offset_default(params) {
|
|||
}
|
||||
}
|
||||
);
|
||||
// look for close points on segmented polys
|
||||
if (false)
|
||||
for (let poly of POLY.flatten(last)) {
|
||||
let ps = poly.segment(offset1, true);
|
||||
let pp = ps.points;
|
||||
let moved = false;
|
||||
pp.push(pp[0]);
|
||||
for (let i=0; i<pp.length; i++) {
|
||||
let p0 = pp[i];
|
||||
if (p0.moved) continue;
|
||||
for (let j=i+1; j<pp.length; j++) {
|
||||
let p1 = pp[j];
|
||||
if (p1.moved) continue;
|
||||
if (p0.segment === p1.segment) {
|
||||
continue;
|
||||
}
|
||||
if (p0.distTo2D(p1) < offset1) {
|
||||
// merge points marking point offset and skip
|
||||
let mid = p0.midPointTo(p1);
|
||||
let inc = p0.distTo2D(mid);
|
||||
moved = p0.moved = p1.moved = inc;
|
||||
p1.skip = true;
|
||||
p0.x = p1.x = mid.x;
|
||||
p0.y = p1.y = mid.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (moved) {
|
||||
poly.points = pp;
|
||||
}
|
||||
}
|
||||
return { last, gaps };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue