@tscircuit/rectdiff 0.0.13 → 0.0.14
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.d.ts +16 -10
- package/dist/index.js +257 -126
- package/lib/solvers/RectDiffExpansionSolver/RectDiffExpansionSolver.ts +59 -12
- package/lib/solvers/RectDiffGridSolverPipeline/RectDiffGridSolverPipeline.ts +25 -6
- package/lib/solvers/RectDiffGridSolverPipeline/buildObstacleIndexes.ts +70 -0
- package/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts +39 -68
- package/lib/solvers/RectDiffSeedingSolver/computeCandidates3D.ts +15 -15
- package/lib/solvers/RectDiffSeedingSolver/computeEdgeCandidates3D.ts +16 -16
- package/lib/solvers/RectDiffSeedingSolver/longestFreeSpanAroundZ.ts +17 -9
- package/lib/types/capacity-mesh-types.ts +9 -0
- package/lib/utils/finalizeRects.ts +25 -20
- package/lib/utils/isFullyOccupiedAtPoint.ts +23 -16
- package/lib/utils/rectToTree.ts +10 -0
- package/lib/utils/resizeSoftOverlaps.ts +36 -7
- package/lib/utils/sameTreeRect.ts +7 -0
- package/package.json +1 -1
- package/tests/examples/example01.test.tsx +18 -1
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,12 @@ interface CapacityMeshNode {
|
|
|
108
108
|
_adjacentNodeIds?: CapacityMeshNodeId[];
|
|
109
109
|
_parent?: CapacityMeshNode;
|
|
110
110
|
}
|
|
111
|
+
type RTreeRect = XYRect & {
|
|
112
|
+
minX: number;
|
|
113
|
+
minY: number;
|
|
114
|
+
maxX: number;
|
|
115
|
+
maxY: number;
|
|
116
|
+
};
|
|
111
117
|
|
|
112
118
|
interface SegmentWithAdjacentEmptySpace {
|
|
113
119
|
parent: CapacityMeshNode;
|
|
@@ -200,7 +206,9 @@ declare class GapFillSolverPipeline extends BasePipelineSolver<{
|
|
|
200
206
|
|
|
201
207
|
type RectDiffSeedingSolverInput = {
|
|
202
208
|
simpleRouteJson: SimpleRouteJson;
|
|
209
|
+
obstacleIndexByLayer: Array<RBush<RTreeRect>>;
|
|
203
210
|
gridOptions?: Partial<GridFill3DOptions>;
|
|
211
|
+
boardVoidRects?: XYRect[];
|
|
204
212
|
};
|
|
205
213
|
/**
|
|
206
214
|
* First phase of RectDiff: grid-based seeding and placement.
|
|
@@ -215,12 +223,11 @@ declare class RectDiffSeedingSolver extends BaseSolver {
|
|
|
215
223
|
private layerCount;
|
|
216
224
|
private bounds;
|
|
217
225
|
private options;
|
|
218
|
-
private
|
|
219
|
-
private boardVoidRects;
|
|
226
|
+
private boardVoidRects?;
|
|
220
227
|
private gridIndex;
|
|
221
228
|
private candidates;
|
|
222
229
|
private placed;
|
|
223
|
-
private
|
|
230
|
+
private placedIndexByLayer;
|
|
224
231
|
private expansionIndex;
|
|
225
232
|
private edgeAnalysisDone;
|
|
226
233
|
private totalSeedsThisGrid;
|
|
@@ -248,12 +255,10 @@ declare class RectDiffSeedingSolver extends BaseSolver {
|
|
|
248
255
|
gridSizes: number[];
|
|
249
256
|
maxMultiLayerSpan: number | undefined;
|
|
250
257
|
};
|
|
251
|
-
|
|
252
|
-
boardVoidRects: XYRect[];
|
|
258
|
+
boardVoidRects: XYRect[] | undefined;
|
|
253
259
|
gridIndex: number;
|
|
254
260
|
candidates: Candidate3D[];
|
|
255
261
|
placed: Placed3D[];
|
|
256
|
-
placedByLayer: XYRect[][];
|
|
257
262
|
expansionIndex: number;
|
|
258
263
|
edgeAnalysisDone: boolean;
|
|
259
264
|
totalSeedsThisGrid: number;
|
|
@@ -274,12 +279,10 @@ type RectDiffExpansionSolverSnapshot = {
|
|
|
274
279
|
gridSizes: number[];
|
|
275
280
|
[key: string]: any;
|
|
276
281
|
};
|
|
277
|
-
obstaclesByLayer: XYRect[][];
|
|
278
282
|
boardVoidRects: XYRect[];
|
|
279
283
|
gridIndex: number;
|
|
280
284
|
candidates: Candidate3D[];
|
|
281
285
|
placed: Placed3D[];
|
|
282
|
-
placedByLayer: XYRect[][];
|
|
283
286
|
expansionIndex: number;
|
|
284
287
|
edgeAnalysisDone: boolean;
|
|
285
288
|
totalSeedsThisGrid: number;
|
|
@@ -287,6 +290,7 @@ type RectDiffExpansionSolverSnapshot = {
|
|
|
287
290
|
};
|
|
288
291
|
type RectDiffExpansionSolverInput = {
|
|
289
292
|
initialSnapshot: RectDiffExpansionSolverSnapshot;
|
|
293
|
+
obstacleIndexByLayer: Array<RBush<RTreeRect>>;
|
|
290
294
|
};
|
|
291
295
|
/**
|
|
292
296
|
* Second phase of RectDiff: expand placed rects to their maximal extents.
|
|
@@ -301,12 +305,11 @@ declare class RectDiffExpansionSolver extends BaseSolver {
|
|
|
301
305
|
private layerCount;
|
|
302
306
|
private bounds;
|
|
303
307
|
private options;
|
|
304
|
-
private obstaclesByLayer;
|
|
305
308
|
private boardVoidRects;
|
|
306
309
|
private gridIndex;
|
|
307
310
|
private candidates;
|
|
308
311
|
private placed;
|
|
309
|
-
private
|
|
312
|
+
private placedIndexByLayer;
|
|
310
313
|
private expansionIndex;
|
|
311
314
|
private edgeAnalysisDone;
|
|
312
315
|
private totalSeedsThisGrid;
|
|
@@ -332,6 +335,9 @@ type RectDiffGridSolverPipelineInput = {
|
|
|
332
335
|
declare class RectDiffGridSolverPipeline extends BasePipelineSolver<RectDiffGridSolverPipelineInput> {
|
|
333
336
|
rectDiffSeedingSolver?: RectDiffSeedingSolver;
|
|
334
337
|
rectDiffExpansionSolver?: RectDiffExpansionSolver;
|
|
338
|
+
private boardVoidRects?;
|
|
339
|
+
private obstacleIndexByLayer;
|
|
340
|
+
constructor(inputProblem: RectDiffGridSolverPipelineInput);
|
|
335
341
|
pipelineDef: PipelineStep<any>[];
|
|
336
342
|
getConstructorParams(): RectDiffGridSolverPipelineInput[];
|
|
337
343
|
getOutput(): {
|