@tscircuit/core 0.0.153 → 0.0.154

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 (2) hide show
  1. package/dist/index.js +32 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3383,6 +3383,7 @@ var getStubEdges = ({
3383
3383
  };
3384
3384
 
3385
3385
  // lib/components/primitive-components/Trace.ts
3386
+ import { doesLineIntersectLine } from "@tscircuit/math-utils";
3386
3387
  var portToObjective = (port) => {
3387
3388
  const portPosition = port._getGlobalPcbPositionAfterLayout();
3388
3389
  return {
@@ -3859,6 +3860,37 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
3859
3860
  to: route[i + 1]
3860
3861
  });
3861
3862
  }
3863
+ const otherEdges = [];
3864
+ for (const otherSchematicTrace of db.schematic_trace.list()) {
3865
+ otherEdges.push(...otherSchematicTrace.edges);
3866
+ }
3867
+ const edgeOrientation = (edge) => {
3868
+ const { from, to } = edge;
3869
+ return from.x === to.x ? "vertical" : "horizontal";
3870
+ };
3871
+ for (const mySegment of edges) {
3872
+ const mySegmentOrientation = edgeOrientation(mySegment);
3873
+ const findOverlappingParallelSegment = () => otherEdges.find(
3874
+ (otherEdge) => edgeOrientation(otherEdge) === mySegmentOrientation && doesLineIntersectLine(
3875
+ [mySegment.from, mySegment.to],
3876
+ [otherEdge.from, otherEdge.to],
3877
+ {
3878
+ lineThickness: 0.01
3879
+ }
3880
+ )
3881
+ );
3882
+ let overlappingParallelSegmentFromOtherTrace = findOverlappingParallelSegment();
3883
+ while (overlappingParallelSegmentFromOtherTrace) {
3884
+ if (mySegmentOrientation === "horizontal") {
3885
+ mySegment.from.y += 0.1;
3886
+ mySegment.to.y += 0.1;
3887
+ } else {
3888
+ mySegment.from.x += 0.1;
3889
+ mySegment.to.x += 0.1;
3890
+ }
3891
+ overlappingParallelSegmentFromOtherTrace = findOverlappingParallelSegment();
3892
+ }
3893
+ }
3862
3894
  const lastEdge = edges[edges.length - 1];
3863
3895
  const lastEdgePort = portsWithPosition[portsWithPosition.length - 1];
3864
3896
  const lastDominantDirection = getDominantDirection(lastEdge);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.153",
4
+ "version": "0.0.154",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",