add polygons helpers to get inner and outer only

This commit is contained in:
Stewart Allen 2022-11-09 16:25:40 -05:00
commit 9d120f5c83
2 changed files with 20 additions and 1 deletions

View file

@ -40,6 +40,8 @@ const POLYS = base.polygons = {
route,
union,
inset,
outer,
inner,
nest,
diff,
setZ,
@ -53,6 +55,23 @@ const POLYS = base.polygons = {
fingerprint
};
function outer(polys) {
for (let p of polys) {
p.inner = undefined;
}
return polys;
}
function inner(polys) {
const ret = [];
for (let p of polys) {
if (p.inner) {
ret.push(p.inner);
}
}
return ret;
}
function length(polys) {
let length = 0;
for (let p of polys) {