@tscircuit/rectdiff 0.0.10 → 0.0.11

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 CHANGED
@@ -1,6 +1,8 @@
1
- import * as _tscircuit_solver_utils from '@tscircuit/solver-utils';
2
- import { BaseSolver, BasePipelineSolver } from '@tscircuit/solver-utils';
1
+ import { BaseSolver, BasePipelineSolver, PipelineStep } from '@tscircuit/solver-utils';
3
2
  import { GraphicsObject } from 'graphics-debug';
3
+ import Flatbush from 'flatbush';
4
+ import RBush from 'rbush';
5
+ import { Bounds } from '@tscircuit/math-utils';
4
6
 
5
7
  type TraceId = string;
6
8
  interface SimpleRouteJson {
@@ -113,18 +115,109 @@ declare class RectDiffSolver extends BaseSolver {
113
115
  visualize(): GraphicsObject;
114
116
  }
115
117
 
118
+ interface SegmentWithAdjacentEmptySpace {
119
+ parent: CapacityMeshNode;
120
+ start: {
121
+ x: number;
122
+ y: number;
123
+ };
124
+ end: {
125
+ x: number;
126
+ y: number;
127
+ };
128
+ z: number;
129
+ facingDirection: "x+" | "x-" | "y+" | "y-";
130
+ }
131
+ /**
132
+ * Find edges with adjacent empty space in the mesh
133
+ *
134
+ * Do this by iterating over each edge of the rect (each step is one edge)
135
+ * and checking if the is completely covered by any other edge
136
+ *
137
+ * If it is completely covered, then it doesn't have an adjacent empty space,
138
+ * continue
139
+ *
140
+ * If it is partially uncovered, then divide it into uncovered segments and add
141
+ * each uncovered segment as a new edge with an adjacent empty space
142
+ */
143
+ declare class FindSegmentsWithAdjacentEmptySpaceSolver extends BaseSolver {
144
+ private input;
145
+ allEdges: Array<SegmentWithAdjacentEmptySpace>;
146
+ unprocessedEdges: Array<SegmentWithAdjacentEmptySpace>;
147
+ segmentsWithAdjacentEmptySpace: Array<SegmentWithAdjacentEmptySpace>;
148
+ edgeSpatialIndex: Flatbush;
149
+ lastCandidateEdge: SegmentWithAdjacentEmptySpace | null;
150
+ lastOverlappingEdges: Array<SegmentWithAdjacentEmptySpace> | null;
151
+ lastUncoveredSegments: Array<SegmentWithAdjacentEmptySpace> | null;
152
+ constructor(input: {
153
+ meshNodes: CapacityMeshNode[];
154
+ });
155
+ _step(): void;
156
+ getOutput(): {
157
+ segmentsWithAdjacentEmptySpace: Array<SegmentWithAdjacentEmptySpace>;
158
+ };
159
+ visualize(): Required<GraphicsObject>;
160
+ }
161
+
162
+ interface ExpandedSegment {
163
+ segment: SegmentWithAdjacentEmptySpace;
164
+ newNode: CapacityMeshNode;
165
+ }
166
+ declare class ExpandEdgesToEmptySpaceSolver extends BaseSolver {
167
+ private input;
168
+ unprocessedSegments: Array<SegmentWithAdjacentEmptySpace>;
169
+ expandedSegments: Array<ExpandedSegment>;
170
+ lastSegment: SegmentWithAdjacentEmptySpace | null;
171
+ lastSearchBounds: Bounds | null;
172
+ lastCollidingNodes: CapacityMeshNode[] | null;
173
+ lastSearchCorner1: {
174
+ x: number;
175
+ y: number;
176
+ } | null;
177
+ lastSearchCorner2: {
178
+ x: number;
179
+ y: number;
180
+ } | null;
181
+ lastExpandedSegment: ExpandedSegment | null;
182
+ rectSpatialIndex: RBush<CapacityMeshNode>;
183
+ constructor(input: {
184
+ inputMeshNodes: CapacityMeshNode[];
185
+ segmentsWithAdjacentEmptySpace: Array<SegmentWithAdjacentEmptySpace>;
186
+ });
187
+ _step(): void;
188
+ getOutput(): {
189
+ expandedSegments: ExpandedSegment[];
190
+ };
191
+ visualize(): Required<GraphicsObject>;
192
+ }
193
+
194
+ declare class GapFillSolverPipeline extends BasePipelineSolver<{
195
+ meshNodes: CapacityMeshNode[];
196
+ }> {
197
+ findSegmentsWithAdjacentEmptySpaceSolver?: FindSegmentsWithAdjacentEmptySpaceSolver;
198
+ expandEdgesToEmptySpaceSolver?: ExpandEdgesToEmptySpaceSolver;
199
+ pipelineDef: PipelineStep<any>[];
200
+ getOutput(): {
201
+ outputNodes: CapacityMeshNode[];
202
+ };
203
+ initialVisualize(): GraphicsObject;
204
+ finalVisualize(): GraphicsObject;
205
+ }
206
+
116
207
  interface RectDiffPipelineInput {
117
208
  simpleRouteJson: SimpleRouteJson;
118
209
  gridOptions?: Partial<GridFill3DOptions>;
119
210
  }
120
211
  declare class RectDiffPipeline extends BasePipelineSolver<RectDiffPipelineInput> {
121
212
  rectDiffSolver?: RectDiffSolver;
122
- pipelineDef: _tscircuit_solver_utils.PipelineStep<RectDiffSolver>[];
213
+ gapFillSolver?: GapFillSolverPipeline;
214
+ pipelineDef: PipelineStep<any>[];
123
215
  getConstructorParams(): RectDiffPipelineInput[];
124
216
  getOutput(): {
125
217
  meshNodes: CapacityMeshNode[];
126
218
  };
127
- visualize(): GraphicsObject;
219
+ initialVisualize(): GraphicsObject;
220
+ finalVisualize(): GraphicsObject;
128
221
  }
129
222
 
130
223
  export { RectDiffPipeline, type RectDiffPipelineInput };