@tscircuit/core 0.0.340 → 0.0.341

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 +13 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3656,7 +3656,18 @@ var pushEdgesOfSchematicTraceToPreventOverlap = ({
3656
3656
  var isRouteOutsideBoard = (mergedRoute, { db }) => {
3657
3657
  const pcbBoard = db.pcb_board.list()[0];
3658
3658
  if (pcbBoard.outline) {
3659
- return true;
3659
+ const boardOutline = pcbBoard.outline;
3660
+ const isInsidePolygon = (point, polygon) => {
3661
+ let inside = false;
3662
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
3663
+ const xi = polygon[i].x, yi = polygon[i].y;
3664
+ const xj = polygon[j].x, yj = polygon[j].y;
3665
+ const intersect = yi > point.y !== yj > point.y && point.x < (xj - xi) * (point.y - yi) / (yj - yi) + xi;
3666
+ if (intersect) inside = !inside;
3667
+ }
3668
+ return inside;
3669
+ };
3670
+ return mergedRoute.some((point) => !isInsidePolygon(point, boardOutline));
3660
3671
  }
3661
3672
  const boardWidth = pcbBoard.width;
3662
3673
  const boardHeight = pcbBoard.height;
@@ -7234,7 +7245,7 @@ import { identity as identity4 } from "transformation-matrix";
7234
7245
  var package_default = {
7235
7246
  name: "@tscircuit/core",
7236
7247
  type: "module",
7237
- version: "0.0.339",
7248
+ version: "0.0.340",
7238
7249
  types: "dist/index.d.ts",
7239
7250
  main: "dist/index.js",
7240
7251
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.340",
4
+ "version": "0.0.341",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",