@tscircuit/rectdiff 0.0.23 → 0.0.24

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.
Files changed (40) hide show
  1. package/dist/index.js +133 -74
  2. package/lib/RectDiffPipeline.ts +4 -37
  3. package/lib/buildFinalRectDiffVisualization.ts +46 -0
  4. package/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts +0 -25
  5. package/lib/solvers/RectDiffSeedingSolver/computeCandidates3D.ts +12 -2
  6. package/lib/solvers/RectDiffSeedingSolver/computeEdgeCandidates3D.ts +53 -13
  7. package/lib/utils/buildOutlineGraphics.ts +39 -0
  8. package/lib/utils/expandRectFromSeed.ts +11 -1
  9. package/package.json +1 -1
  10. package/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg +1 -1
  11. package/tests/solver/bugreport01-be84eb/__snapshots__/bugreport01-be84eb.snap.svg +2 -2
  12. package/tests/solver/bugreport02-bc4361/__snapshots__/bugreport02-bc4361.snap.svg +2 -2
  13. package/tests/solver/bugreport03-fe4a17/__snapshots__/bugreport03-fe4a17.snap.svg +1 -1
  14. package/tests/solver/bugreport07-d3f3be/__snapshots__/bugreport07-d3f3be.snap.svg +1 -1
  15. package/tests/solver/bugreport08-e3ec95/__snapshots__/bugreport08-e3ec95.snap.svg +1 -1
  16. package/tests/solver/bugreport09-618e09/__snapshots__/bugreport09-618e09.snap.svg +2 -2
  17. package/tests/solver/bugreport10-71239a/__snapshots__/bugreport10-71239a.snap.svg +2 -2
  18. package/tests/solver/bugreport11-b2de3c/__snapshots__/bugreport11-b2de3c.snap.svg +1 -1
  19. package/tests/solver/bugreport11-b2de3c/bugreport11-b2de3c-clearance-equivalence.test.ts +52 -0
  20. package/tests/solver/bugreport12-35ce1c/__snapshots__/bugreport12-35ce1c.snap.svg +1 -1
  21. package/tests/solver/bugreport13-b9a758/__snapshots__/bugreport13-b9a758.snap.svg +2 -2
  22. package/tests/solver/bugreport16-d95f38/__snapshots__/bugreport16-d95f38.snap.svg +2 -2
  23. package/tests/solver/bugreport19/__snapshots__/bugreport19.snap.svg +1 -1
  24. package/tests/solver/bugreport22-2a75ce/__snapshots__/bugreport22-2a75ce.snap.svg +1 -1
  25. package/tests/solver/bugreport23-LGA15x4/__snapshots__/bugreport23-LGA15x4.snap.svg +1 -1
  26. package/tests/solver/bugreport24-05597c/__snapshots__/bugreport24-05597c.snap.svg +1 -1
  27. package/tests/solver/bugreport26-66b0b2/__snapshots__/bugreport26-66b0b2.snap.svg +2 -2
  28. package/tests/solver/bugreport27-dd3734/__snapshots__/bugreport27-dd3734.snap.svg +2 -2
  29. package/tests/solver/bugreport28-18a9ef/__snapshots__/bugreport28-18a9ef.snap.svg +2 -2
  30. package/tests/solver/bugreport29-7deae8/__snapshots__/bugreport29-7deae8.snap.svg +2 -2
  31. package/tests/solver/bugreport30-2174c8/__snapshots__/bugreport30-2174c8.snap.svg +1 -1
  32. package/tests/solver/bugreport33-213d45/__snapshots__/bugreport33-213d45.snap.svg +2 -2
  33. package/tests/solver/bugreport34-e9dea2/__snapshots__/bugreport34-e9dea2.snap.svg +2 -2
  34. package/tests/solver/bugreport35-191db9/__snapshots__/bugreport35-191db9.snap.svg +2 -2
  35. package/tests/solver/bugreport36-bf8303/__snapshots__/bugreport36-bf8303.snap.svg +1 -1
  36. package/tests/solver/interaction/__snapshots__/interaction.snap.svg +1 -1
  37. package/tests/solver/multi-point/__snapshots__/multi-point.snap.svg +1 -1
  38. package/tests/solver/pcb_trace_id-should-return-root-connection-name/__snapshots__/pcb_trace_id-should-return-root-connection-name.snap.svg +1 -1
  39. package/tests/solver/bugreport11-b2de3c/__snapshots__/bugreport11-b2de3c-clearance.snap.svg +0 -44
  40. package/tests/solver/bugreport11-b2de3c/bugreport11-b2de3c-clearance.test.ts +0 -97
@@ -17,6 +17,16 @@ type ExpandDirectionParams = {
17
17
  maxAspect: number | null | undefined
18
18
  }
19
19
 
20
+ const quantize = (value: number, precision = 1e-6) =>
21
+ Math.round(value / precision) * precision
22
+
23
+ const quantizeRect = (rect: XYRect): XYRect => ({
24
+ x: quantize(rect.x),
25
+ y: quantize(rect.y),
26
+ width: quantize(rect.width),
27
+ height: quantize(rect.height),
28
+ })
29
+
20
30
  function maxExpandRight(params: ExpandDirectionParams) {
21
31
  const { r, bounds, blockers, maxAspect } = params
22
32
  // Start with board boundary
@@ -333,7 +343,7 @@ export function expandRectFromSeed(params: {
333
343
  if (r.width + EPS >= minReq.width && r.height + EPS >= minReq.height) {
334
344
  const area = r.width * r.height
335
345
  if (area > bestArea) {
336
- best = r
346
+ best = quantizeRect(r)
337
347
  bestArea = area
338
348
  }
339
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/rectdiff",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {