Basic outlining done
This commit is contained in:
parent
12f97a9171
commit
a21f672839
5 changed files with 31 additions and 13 deletions
|
@ -38,6 +38,10 @@ exports.rect = (w, h, o=[0, 0], mirrored=false) => {
|
|||
return m.model.move({paths: res}, o)
|
||||
}
|
||||
|
||||
const eq = exports.eq = (a=[], b=[]) => {
|
||||
return a[0] === b[0] && a[1] === b[1]
|
||||
}
|
||||
|
||||
exports.poly = (arr) => {
|
||||
let counter = 0
|
||||
let prev = arr[arr.length - 1]
|
||||
|
@ -45,12 +49,10 @@ exports.poly = (arr) => {
|
|||
paths: {}
|
||||
}
|
||||
for (const p of arr) {
|
||||
if (eq(prev, p)) continue
|
||||
res.paths['p' + (++counter)] = line(prev, p)
|
||||
prev = p
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
exports.eq = (a, b) => {
|
||||
return a[0] === b[0] && a[1] === b[1]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue