calculate-packing 0.0.48 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2196,6 +2196,11 @@ var SingleComponentPackSolver = class extends BaseSolver {
|
|
|
2196
2196
|
return distance2 + 1e-6 < this.minGap;
|
|
2197
2197
|
});
|
|
2198
2198
|
});
|
|
2199
|
+
let outsideBounds = false;
|
|
2200
|
+
if (this.bounds) {
|
|
2201
|
+
const componentBounds = getComponentBounds(candidateComponent, 0);
|
|
2202
|
+
outsideBounds = componentBounds.minX < this.bounds.minX || componentBounds.maxX > this.bounds.maxX || componentBounds.minY < this.bounds.minY || componentBounds.maxY > this.bounds.maxY;
|
|
2203
|
+
}
|
|
2199
2204
|
let outsideBoundaryOutline = false;
|
|
2200
2205
|
if (this.boundaryOutline && this.boundaryOutline.length >= 3) {
|
|
2201
2206
|
const componentBounds = getComponentBounds(candidateComponent, 0);
|
|
@@ -2231,6 +2236,17 @@ var SingleComponentPackSolver = class extends BaseSolver {
|
|
|
2231
2236
|
rotationIndex: this.currentRotationIndex,
|
|
2232
2237
|
gapDistance: minObstacleGapDistance
|
|
2233
2238
|
});
|
|
2239
|
+
} else if (outsideBounds) {
|
|
2240
|
+
this.rejectedCandidates.push({
|
|
2241
|
+
segment: queuedSegment.segment,
|
|
2242
|
+
rotation,
|
|
2243
|
+
optimalPosition,
|
|
2244
|
+
distance,
|
|
2245
|
+
segmentIndex: queuedSegment.segmentIndex,
|
|
2246
|
+
rotationIndex: this.currentRotationIndex,
|
|
2247
|
+
gapDistance: -1
|
|
2248
|
+
// Special marker for bounds violation
|
|
2249
|
+
});
|
|
2234
2250
|
} else if (outsideBoundaryOutline) {
|
|
2235
2251
|
this.rejectedCandidates.push({
|
|
2236
2252
|
segment: queuedSegment.segment,
|
package/package.json
CHANGED