first sketch union
This commit is contained in:
parent
b8ccf456c1
commit
54ffc506bd
4 changed files with 172 additions and 28 deletions
|
|
@ -110,6 +110,19 @@ class Polygon {
|
|||
return this;
|
||||
}
|
||||
|
||||
toObject() {
|
||||
return {
|
||||
points: this.toArray(),
|
||||
inner: this.inner?.map(i => i.toArray())
|
||||
};
|
||||
}
|
||||
|
||||
fromObject(obj) {
|
||||
this.fromArray(obj.points);
|
||||
this.inner = obj.inner?.map(a => newPolygon().fromArray(a))
|
||||
return this;
|
||||
}
|
||||
|
||||
matches(poly) {
|
||||
let tarr = Array.isArray(poly) ? poly : poly.toArray();
|
||||
let parr = this.toArray();
|
||||
|
|
|
|||
Loading…
Reference in a new issue