diff --git a/src/Polygon.ts b/src/Polygon.ts index 75ba490e..0b15a6bb 100644 --- a/src/Polygon.ts +++ b/src/Polygon.ts @@ -341,6 +341,12 @@ export class Polygon { }) } + scale(scale: number) { + this.vertices.forEach((vertex) => { + vertex.multiplyScalar(scale) + }) + } + equals(polygon: Polygon, epsilon: number = 0) { if (this.isQuad() !== polygon.isQuad()) { return false diff --git a/src/Polygons.ts b/src/Polygons.ts index bc20b922..acfebe01 100644 --- a/src/Polygons.ts +++ b/src/Polygons.ts @@ -130,6 +130,12 @@ export class Polygons extends Array { }) } + scale(scale: number) { + this.forEach((polygon) => { + polygon.scale(scale) + }) + } + empty() { this.length = 0 }