@tscircuit/math-utils 0.0.31 → 0.0.32

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.
@@ -109,10 +109,11 @@ var isRectOverlappingPolygon = (rect, polygon) => areBoundsOverlappingPolygon(un
109
109
  var isRectCompletelyInsidePolygon = (rect, polygon) => areBoundsCompletelyInsidePolygon(universalRectToBounds(rect), polygon);
110
110
 
111
111
  export {
112
+ isPointInsideBounds,
112
113
  isPointInsidePolygon,
113
114
  areBoundsOverlappingPolygon,
114
115
  areBoundsCompletelyInsidePolygon,
115
116
  isRectOverlappingPolygon,
116
117
  isRectCompletelyInsidePolygon
117
118
  };
118
- //# sourceMappingURL=chunk-RCZE5Q5V.js.map
119
+ //# sourceMappingURL=chunk-6K6N6UTQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/polygon.ts"],"sourcesContent":["import type { Bounds, Point, UniversalRect } from \"./common\"\nimport { doSegmentsIntersect } from \"./line-intersections\"\n\nexport type Polygon = readonly Point[]\n\nconst universalRectToBounds = (rect: UniversalRect): Bounds => {\n if (\"minX\" in rect) {\n return rect\n }\n\n const halfWidth = rect.width / 2\n const halfHeight = rect.height / 2\n\n return {\n minX: rect.center.x - halfWidth,\n minY: rect.center.y - halfHeight,\n maxX: rect.center.x + halfWidth,\n maxY: rect.center.y + halfHeight,\n }\n}\n\nconst getBoundsCorners = (bounds: Bounds): Point[] => [\n { x: bounds.minX, y: bounds.minY },\n { x: bounds.maxX, y: bounds.minY },\n { x: bounds.maxX, y: bounds.maxY },\n { x: bounds.minX, y: bounds.maxY },\n]\n\nconst getPolygonEdges = (polygon: Polygon): Array<[Point, Point]> => {\n const edges: Array<[Point, Point]> = []\n for (let i = 0; i < polygon.length; i++) {\n const start = polygon[i]\n const end = polygon[(i + 1) % polygon.length]\n edges.push([start, end])\n }\n return edges\n}\n\nconst isPointOnSegment = (point: Point, start: Point, end: Point): boolean => {\n const cross =\n (point.y - start.y) * (end.x - start.x) -\n (point.x - start.x) * (end.y - start.y)\n if (Math.abs(cross) > 1e-9) {\n return false\n }\n\n const dot =\n (point.x - start.x) * (end.x - start.x) +\n (point.y - start.y) * (end.y - start.y)\n if (dot < 0) {\n return false\n }\n\n const squaredLength = (end.x - start.x) ** 2 + (end.y - start.y) ** 2\n if (dot > squaredLength) {\n return false\n }\n\n return true\n}\n\nexport const isPointInsideBounds = (point: Point, bounds: Bounds): boolean =>\n point.x >= bounds.minX &&\n point.x <= bounds.maxX &&\n point.y >= bounds.minY &&\n point.y <= bounds.maxY\n\nexport const isPointInsidePolygon = (\n point: Point,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n const edges = getPolygonEdges(polygon)\n for (const [start, end] of edges) {\n if (isPointOnSegment(point, start, end)) {\n return true\n }\n }\n\n let inside = false\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x\n const yi = polygon[i].y\n const xj = polygon[j].x\n const yj = polygon[j].y\n\n const intersects =\n yi > point.y !== yj > point.y &&\n point.x < ((xj - xi) * (point.y - yi)) / (yj - yi) + xi\n\n if (intersects) {\n inside = !inside\n }\n }\n\n return inside\n}\n\nconst doesPolygonIntersectBounds = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n const boundsCorners = getBoundsCorners(bounds)\n const boundsEdges: Array<[Point, Point]> = [\n [boundsCorners[0], boundsCorners[1]],\n [boundsCorners[1], boundsCorners[2]],\n [boundsCorners[2], boundsCorners[3]],\n [boundsCorners[3], boundsCorners[0]],\n ]\n\n const polygonEdges = getPolygonEdges(polygon)\n\n for (const [start, end] of polygonEdges) {\n for (const [rectStart, rectEnd] of boundsEdges) {\n if (doSegmentsIntersect(start, end, rectStart, rectEnd)) {\n return true\n }\n }\n }\n\n return false\n}\n\nexport const areBoundsOverlappingPolygon = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n if (polygon.some((point) => isPointInsideBounds(point, bounds))) {\n return true\n }\n\n const corners = getBoundsCorners(bounds)\n if (corners.some((corner) => isPointInsidePolygon(corner, polygon))) {\n return true\n }\n\n return doesPolygonIntersectBounds(bounds, polygon)\n}\n\nexport const areBoundsCompletelyInsidePolygon = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n const corners = getBoundsCorners(bounds)\n if (!corners.every((corner) => isPointInsidePolygon(corner, polygon))) {\n return false\n }\n\n return !doesPolygonIntersectBounds(bounds, polygon)\n}\n\nexport const isRectOverlappingPolygon = (\n rect: UniversalRect,\n polygon: Polygon,\n): boolean => areBoundsOverlappingPolygon(universalRectToBounds(rect), polygon)\n\nexport const isRectCompletelyInsidePolygon = (\n rect: UniversalRect,\n polygon: Polygon,\n): boolean =>\n areBoundsCompletelyInsidePolygon(universalRectToBounds(rect), polygon)\n"],"mappings":";;;;;AAKA,IAAM,wBAAwB,CAAC,SAAgC;AAC7D,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,KAAK,QAAQ;AAC/B,QAAM,aAAa,KAAK,SAAS;AAEjC,SAAO;AAAA,IACL,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,EACxB;AACF;AAEA,IAAM,mBAAmB,CAAC,WAA4B;AAAA,EACpD,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AACnC;AAEA,IAAM,kBAAkB,CAAC,YAA4C;AACnE,QAAM,QAA+B,CAAC;AACtC,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;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AAC,QAAQ,MAAM,CAAC,WAAW,qBAAqB,QAAQ,OAAO,CAAC,GAAG;AACrE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,2BAA2B,QAAQ,OAAO;AACpD;AAEO,IAAM,2BAA2B,CACtC,MACA,YACY,4BAA4B,sBAAsB,IAAI,GAAG,OAAO;AAEvE,IAAM,gCAAgC,CAC3C,MACA,YAEA,iCAAiC,sBAAsB,IAAI,GAAG,OAAO;","names":[]}
package/dist/index.d.ts CHANGED
@@ -11,7 +11,6 @@ export { doBoundsOverlap } from './bounds-overlap.js';
11
11
  export { boundsAreaOverlap } from './bounds-area-overlap.js';
12
12
  export { boundsDistance } from './bounds-distance.js';
13
13
  export { boundsIntersection } from './bounds-intersection.js';
14
- export { Polygon, areBoundsCompletelyInsidePolygon, areBoundsOverlappingPolygon, isPointInsidePolygon, isRectCompletelyInsidePolygon, isRectOverlappingPolygon } from './polygon.js';
14
+ export { Polygon, areBoundsCompletelyInsidePolygon, areBoundsOverlappingPolygon, isPointInsideBounds, isPointInsidePolygon, isRectCompletelyInsidePolygon, isRectOverlappingPolygon } from './polygon.js';
15
15
  export { normalizeDegrees } from './normalize-degrees.js';
16
16
  export { getBoundsFromPoints } from './get-bounds-from-points.js';
17
- export { isPointInBounds } from './is-point-in-bounds.js';
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- import {
2
- range
3
- } from "./chunk-KY53E6CT.js";
4
1
  import {
5
2
  pointToSegmentClosestPoint,
6
3
  segmentToBoundsMinDistance,
@@ -8,9 +5,6 @@ import {
8
5
  segmentToCircleMinDistance,
9
6
  segmentToSegmentMinDistance
10
7
  } from "./chunk-6PD3WN3Y.js";
11
- import {
12
- isPointInBounds
13
- } from "./chunk-TDJ6LMXM.js";
14
8
  import {
15
9
  normalizeDegrees
16
10
  } from "./chunk-P6GW5PWY.js";
@@ -32,10 +26,11 @@ import "./chunk-MTORG67J.js";
32
26
  import {
33
27
  areBoundsCompletelyInsidePolygon,
34
28
  areBoundsOverlappingPolygon,
29
+ isPointInsideBounds,
35
30
  isPointInsidePolygon,
36
31
  isRectCompletelyInsidePolygon,
37
32
  isRectOverlappingPolygon
38
- } from "./chunk-RCZE5Q5V.js";
33
+ } from "./chunk-6K6N6UTQ.js";
39
34
  import {
40
35
  distance,
41
36
  doSegmentsIntersect,
@@ -46,6 +41,9 @@ import {
46
41
  orientation,
47
42
  pointToSegmentDistance
48
43
  } from "./chunk-EFLPMB4J.js";
44
+ import {
45
+ range
46
+ } from "./chunk-KY53E6CT.js";
49
47
  import {
50
48
  boundsAreaOverlap
51
49
  } from "./chunk-YA3GC5BB.js";
@@ -92,7 +90,7 @@ export {
92
90
  getUnitVectorFromDirection,
93
91
  getUnitVectorFromPointAToB,
94
92
  grid,
95
- isPointInBounds,
93
+ isPointInsideBounds,
96
94
  isPointInsidePolygon,
97
95
  isRectCompletelyInsidePolygon,
98
96
  isRectOverlappingPolygon,
package/dist/polygon.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Point, Bounds, UniversalRect } from './common.js';
2
2
 
3
3
  type Polygon = readonly Point[];
4
+ declare const isPointInsideBounds: (point: Point, bounds: Bounds) => boolean;
4
5
  declare const isPointInsidePolygon: (point: Point, polygon: Polygon) => boolean;
5
6
  declare const areBoundsOverlappingPolygon: (bounds: Bounds, polygon: Polygon) => boolean;
6
7
  declare const areBoundsCompletelyInsidePolygon: (bounds: Bounds, polygon: Polygon) => boolean;
7
8
  declare const isRectOverlappingPolygon: (rect: UniversalRect, polygon: Polygon) => boolean;
8
9
  declare const isRectCompletelyInsidePolygon: (rect: UniversalRect, polygon: Polygon) => boolean;
9
10
 
10
- export { type Polygon, areBoundsCompletelyInsidePolygon, areBoundsOverlappingPolygon, isPointInsidePolygon, isRectCompletelyInsidePolygon, isRectOverlappingPolygon };
11
+ export { type Polygon, areBoundsCompletelyInsidePolygon, areBoundsOverlappingPolygon, isPointInsideBounds, isPointInsidePolygon, isRectCompletelyInsidePolygon, isRectOverlappingPolygon };
package/dist/polygon.js CHANGED
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  areBoundsCompletelyInsidePolygon,
3
3
  areBoundsOverlappingPolygon,
4
+ isPointInsideBounds,
4
5
  isPointInsidePolygon,
5
6
  isRectCompletelyInsidePolygon,
6
7
  isRectOverlappingPolygon
7
- } from "./chunk-RCZE5Q5V.js";
8
+ } from "./chunk-6K6N6UTQ.js";
8
9
  import "./chunk-EFLPMB4J.js";
9
10
  export {
10
11
  areBoundsCompletelyInsidePolygon,
11
12
  areBoundsOverlappingPolygon,
13
+ isPointInsideBounds,
12
14
  isPointInsidePolygon,
13
15
  isRectCompletelyInsidePolygon,
14
16
  isRectOverlappingPolygon
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/math-utils",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.31",
4
+ "version": "0.0.32",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/polygon.ts"],"sourcesContent":["import type { Bounds, Point, UniversalRect } from \"./common\"\nimport { doSegmentsIntersect } from \"./line-intersections\"\n\nexport type Polygon = readonly Point[]\n\nconst universalRectToBounds = (rect: UniversalRect): Bounds => {\n if (\"minX\" in rect) {\n return rect\n }\n\n const halfWidth = rect.width / 2\n const halfHeight = rect.height / 2\n\n return {\n minX: rect.center.x - halfWidth,\n minY: rect.center.y - halfHeight,\n maxX: rect.center.x + halfWidth,\n maxY: rect.center.y + halfHeight,\n }\n}\n\nconst getBoundsCorners = (bounds: Bounds): Point[] => [\n { x: bounds.minX, y: bounds.minY },\n { x: bounds.maxX, y: bounds.minY },\n { x: bounds.maxX, y: bounds.maxY },\n { x: bounds.minX, y: bounds.maxY },\n]\n\nconst getPolygonEdges = (polygon: Polygon): Array<[Point, Point]> => {\n const edges: Array<[Point, Point]> = []\n for (let i = 0; i < polygon.length; i++) {\n const start = polygon[i]\n const end = polygon[(i + 1) % polygon.length]\n edges.push([start, end])\n }\n return edges\n}\n\nconst isPointOnSegment = (point: Point, start: Point, end: Point): boolean => {\n const cross =\n (point.y - start.y) * (end.x - start.x) -\n (point.x - start.x) * (end.y - start.y)\n if (Math.abs(cross) > 1e-9) {\n return false\n }\n\n const dot =\n (point.x - start.x) * (end.x - start.x) +\n (point.y - start.y) * (end.y - start.y)\n if (dot < 0) {\n return false\n }\n\n const squaredLength = (end.x - start.x) ** 2 + (end.y - start.y) ** 2\n if (dot > squaredLength) {\n return false\n }\n\n return true\n}\n\nconst isPointInsideBounds = (point: Point, bounds: Bounds): boolean =>\n point.x >= bounds.minX &&\n point.x <= bounds.maxX &&\n point.y >= bounds.minY &&\n point.y <= bounds.maxY\n\nexport const isPointInsidePolygon = (\n point: Point,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n const edges = getPolygonEdges(polygon)\n for (const [start, end] of edges) {\n if (isPointOnSegment(point, start, end)) {\n return true\n }\n }\n\n let inside = false\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x\n const yi = polygon[i].y\n const xj = polygon[j].x\n const yj = polygon[j].y\n\n const intersects =\n yi > point.y !== yj > point.y &&\n point.x < ((xj - xi) * (point.y - yi)) / (yj - yi) + xi\n\n if (intersects) {\n inside = !inside\n }\n }\n\n return inside\n}\n\nconst doesPolygonIntersectBounds = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n const boundsCorners = getBoundsCorners(bounds)\n const boundsEdges: Array<[Point, Point]> = [\n [boundsCorners[0], boundsCorners[1]],\n [boundsCorners[1], boundsCorners[2]],\n [boundsCorners[2], boundsCorners[3]],\n [boundsCorners[3], boundsCorners[0]],\n ]\n\n const polygonEdges = getPolygonEdges(polygon)\n\n for (const [start, end] of polygonEdges) {\n for (const [rectStart, rectEnd] of boundsEdges) {\n if (doSegmentsIntersect(start, end, rectStart, rectEnd)) {\n return true\n }\n }\n }\n\n return false\n}\n\nexport const areBoundsOverlappingPolygon = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n if (polygon.some((point) => isPointInsideBounds(point, bounds))) {\n return true\n }\n\n const corners = getBoundsCorners(bounds)\n if (corners.some((corner) => isPointInsidePolygon(corner, polygon))) {\n return true\n }\n\n return doesPolygonIntersectBounds(bounds, polygon)\n}\n\nexport const areBoundsCompletelyInsidePolygon = (\n bounds: Bounds,\n polygon: Polygon,\n): boolean => {\n if (polygon.length < 3) return false\n\n const corners = getBoundsCorners(bounds)\n if (!corners.every((corner) => isPointInsidePolygon(corner, polygon))) {\n return false\n }\n\n return !doesPolygonIntersectBounds(bounds, polygon)\n}\n\nexport const isRectOverlappingPolygon = (\n rect: UniversalRect,\n polygon: Polygon,\n): boolean => areBoundsOverlappingPolygon(universalRectToBounds(rect), polygon)\n\nexport const isRectCompletelyInsidePolygon = (\n rect: UniversalRect,\n polygon: Polygon,\n): boolean =>\n areBoundsCompletelyInsidePolygon(universalRectToBounds(rect), polygon)\n"],"mappings":";;;;;AAKA,IAAM,wBAAwB,CAAC,SAAgC;AAC7D,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,KAAK,QAAQ;AAC/B,QAAM,aAAa,KAAK,SAAS;AAEjC,SAAO;AAAA,IACL,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,IACtB,MAAM,KAAK,OAAO,IAAI;AAAA,EACxB;AACF;AAEA,IAAM,mBAAmB,CAAC,WAA4B;AAAA,EACpD,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAAA,EACjC,EAAE,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AACnC;AAEA,I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,CAC9C,QACA,YACY;AACZ,MAAI,QAAQ,SAAS,EAAG,QAAO;AAE/B,QAAM,UAAU,iBAAiB,MAAM;AACvC,MAAI,CAAC,QAAQ,MAAM,CAAC,WAAW,qBAAqB,QAAQ,OAAO,CAAC,GAAG;AACrE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,2BAA2B,QAAQ,OAAO;AACpD;AAEO,IAAM,2BAA2B,CACtC,MACA,YACY,4BAA4B,sBAAsB,IAAI,GAAG,OAAO;AAEvE,IAAM,gCAAgC,CAC3C,MACA,YAEA,iCAAiC,sBAAsB,IAAI,GAAG,OAAO;","names":[]}
@@ -1,9 +0,0 @@
1
- // src/is-point-in-bounds.ts
2
- var isPointInBounds = (point, bounds) => {
3
- return point.x >= bounds.minX && point.x <= bounds.maxX && point.y >= bounds.minY && point.y <= bounds.maxY;
4
- };
5
-
6
- export {
7
- isPointInBounds
8
- };
9
- //# sourceMappingURL=chunk-TDJ6LMXM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/is-point-in-bounds.ts"],"sourcesContent":["import type { Bounds, Point } from \"./common\"\n\n/**\n * Determines if a point is inside or on the boundary of a bounds rectangle\n * @param point The point to check\n * @param bounds The bounding rectangle\n * @returns true if the point is within the bounds, false otherwise\n */\nexport const isPointInBounds = (point: Point, bounds: Bounds): boolean => {\n return (\n point.x >= bounds.minX &&\n point.x <= bounds.maxX &&\n point.y >= bounds.minY &&\n point.y <= bounds.maxY\n )\n}\n"],"mappings":";AAQO,IAAM,kBAAkB,CAAC,OAAc,WAA4B;AACxE,SACE,MAAM,KAAK,OAAO,QAClB,MAAM,KAAK,OAAO,QAClB,MAAM,KAAK,OAAO,QAClB,MAAM,KAAK,OAAO;AAEtB;","names":[]}
@@ -1,11 +0,0 @@
1
- import { Point, Bounds } from './common.js';
2
-
3
- /**
4
- * Determines if a point is inside or on the boundary of a bounds rectangle
5
- * @param point The point to check
6
- * @param bounds The bounding rectangle
7
- * @returns true if the point is within the bounds, false otherwise
8
- */
9
- declare const isPointInBounds: (point: Point, bounds: Bounds) => boolean;
10
-
11
- export { isPointInBounds };
@@ -1,7 +0,0 @@
1
- import {
2
- isPointInBounds
3
- } from "./chunk-TDJ6LMXM.js";
4
- export {
5
- isPointInBounds
6
- };
7
- //# sourceMappingURL=is-point-in-bounds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}