add polygons helpers to get inner and outer only
This commit is contained in:
parent
fa545e9f6d
commit
9d120f5c83
2 changed files with 20 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue