Comparing version 2.4.40 to 2.4.41
@@ -49,2 +49,3 @@ /// <reference types="offscreencanvas" /> | ||
get area(): number; | ||
get filledDeintersection(): DPolygon; | ||
get deintersection(): DPolygon; | ||
@@ -51,0 +52,0 @@ get valid(): boolean; |
@@ -226,2 +226,31 @@ import { DPoint } from './DPoint'; | ||
} | ||
get filledDeintersection() { | ||
const p = this.clone().deintersection.removeDuplicates().clockWise.open(); | ||
const findSameCorners = (startIndex = 0) => { | ||
const store = {}; | ||
for (let i = startIndex; i < p.length; i++) { | ||
const key = p.at(i).toString(); | ||
if (typeof store[key] === 'number') { | ||
return [store[key], i]; | ||
} | ||
store[key] = i; | ||
} | ||
return undefined; | ||
}; | ||
let indexes = findSameCorners(); | ||
const holes = []; | ||
while (indexes) { | ||
const a = new DPolygon(p.clone().removePart(indexes[0], indexes[1] - indexes[0])); | ||
if (a.isClockwise) { | ||
indexes = findSameCorners(indexes[0] + 1); | ||
} | ||
else { | ||
holes.push(a.close()); | ||
p.removePart(indexes[0], indexes[1] - indexes[0]); | ||
indexes = findSameCorners(); | ||
} | ||
} | ||
p.holes = holes; | ||
return p.close(); | ||
} | ||
get deintersection() { | ||
@@ -228,0 +257,0 @@ let p = this.clone().close(); |
{ | ||
"name": "dgeoutils", | ||
"version": "2.4.40", | ||
"version": "2.4.41", | ||
"description": "Geometries utils for my projects", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1365476
19042