experimental new form of thin wall handling

This commit is contained in:
Stewart Allen 2021-02-20 10:55:59 -05:00
commit 3c4a282f67
2 changed files with 40 additions and 7 deletions

View file

@ -30,6 +30,7 @@
expand,
expand_lines,
union,
inset,
nest,
diff,
setZ,
@ -540,6 +541,22 @@
return opts.flat ? opts.outs : polys;
}
function inset(polys, dist, count, z) {
let total = count;
let layers = [];
let ref = polys;
while (count-- > 0 && ref && ref.length) {
let off = offset(ref, -dist, {z});
let mid = offset(off, dist / 2, {z});
let cmp = offset(off, dist, {z});
let gap = [];
subtract(ref, cmp, gap, null, z);
layers.push({idx: total-count, off, mid, gap});
ref = off;
}
return layers;
}
/**
* todo use clipper opne poly clipping?
*