@tscircuit/math-utils 0.0.33 → 0.0.34

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.
@@ -1,9 +1,9 @@
1
- import {
2
- clamp
3
- } from "./chunk-DRDDWFOS.js";
4
1
  import {
5
2
  distance
6
3
  } from "./chunk-EFLPMB4J.js";
4
+ import {
5
+ clamp
6
+ } from "./chunk-DRDDWFOS.js";
7
7
 
8
8
  // src/point-distance.ts
9
9
  function pointToBoxDistance(p, box) {
@@ -46,4 +46,4 @@ export {
46
46
  midpoint,
47
47
  distSq
48
48
  };
49
- //# sourceMappingURL=chunk-BLY7FZPX.js.map
49
+ //# sourceMappingURL=chunk-5J3PCV4D.js.map
@@ -1,11 +1,11 @@
1
- import {
2
- clamp
3
- } from "./chunk-DRDDWFOS.js";
4
1
  import {
5
2
  distance,
6
3
  doSegmentsIntersect,
7
4
  pointToSegmentDistance
8
5
  } from "./chunk-EFLPMB4J.js";
6
+ import {
7
+ clamp
8
+ } from "./chunk-DRDDWFOS.js";
9
9
 
10
10
  // src/segment-distance.ts
11
11
  function segmentToSegmentMinDistance(a, b, u, v) {
@@ -109,4 +109,4 @@ export {
109
109
  segmentToCircleMinDistance,
110
110
  pointToSegmentClosestPoint
111
111
  };
112
- //# sourceMappingURL=chunk-6PD3WN3Y.js.map
112
+ //# sourceMappingURL=chunk-Y7G4VXR7.js.map
@@ -0,0 +1,14 @@
1
+ import { Point, Bounds } from './common.js';
2
+
3
+ /**
4
+ * Calculates the bounds of a rectangle given its center point, width, and height.
5
+ * @param params Object containing center point (x, y), width, and height of the rectangle
6
+ * @returns Bounds object containing minX, minY, maxX, maxY
7
+ */
8
+ declare const getBoundFromCenteredRect: (params: {
9
+ center: Point;
10
+ width: number;
11
+ height: number;
12
+ }) => Bounds;
13
+
14
+ export { getBoundFromCenteredRect };
@@ -0,0 +1,16 @@
1
+ // src/get-bound-from-centered-rect.ts
2
+ var getBoundFromCenteredRect = (params) => {
3
+ const { center, width, height } = params;
4
+ const halfWidth = width / 2;
5
+ const halfHeight = height / 2;
6
+ return {
7
+ minX: center.x - halfWidth,
8
+ maxX: center.x + halfWidth,
9
+ minY: center.y - halfHeight,
10
+ maxY: center.y + halfHeight
11
+ };
12
+ };
13
+ export {
14
+ getBoundFromCenteredRect
15
+ };
16
+ //# sourceMappingURL=get-bound-from-centered-rect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/get-bound-from-centered-rect.ts"],"sourcesContent":["import type { Bounds, Point } from \"./common\"\n\n/**\n * Calculates the bounds of a rectangle given its center point, width, and height.\n * @param params Object containing center point (x, y), width, and height of the rectangle\n * @returns Bounds object containing minX, minY, maxX, maxY\n */\nexport const getBoundFromCenteredRect = (params: {\n center: Point\n width: number\n height: number\n}): Bounds => {\n const { center, width, height } = params\n const halfWidth = width / 2\n const halfHeight = height / 2\n\n return {\n minX: center.x - halfWidth,\n maxX: center.x + halfWidth,\n minY: center.y - halfHeight,\n maxY: center.y + halfHeight,\n }\n}\n"],"mappings":";AAOO,IAAM,2BAA2B,CAAC,WAI3B;AACZ,QAAM,EAAE,QAAQ,OAAO,OAAO,IAAI;AAClC,QAAM,YAAY,QAAQ;AAC1B,QAAM,aAAa,SAAS;AAE5B,SAAO;AAAA,IACL,MAAM,OAAO,IAAI;AAAA,IACjB,MAAM,OAAO,IAAI;AAAA,IACjB,MAAM,OAAO,IAAI;AAAA,IACjB,MAAM,OAAO,IAAI;AAAA,EACnB;AACF;","names":[]}
package/dist/index.js CHANGED
@@ -1,3 +1,11 @@
1
+ import {
2
+ areBoundsCompletelyInsidePolygon,
3
+ areBoundsOverlappingPolygon,
4
+ isPointInsideBounds,
5
+ isPointInsidePolygon,
6
+ isRectCompletelyInsidePolygon,
7
+ isRectOverlappingPolygon
8
+ } from "./chunk-6K6N6UTQ.js";
1
9
  import {
2
10
  range
3
11
  } from "./chunk-KY53E6CT.js";
@@ -7,7 +15,11 @@ import {
7
15
  segmentToBoxMinDistance,
8
16
  segmentToCircleMinDistance,
9
17
  segmentToSegmentMinDistance
10
- } from "./chunk-6PD3WN3Y.js";
18
+ } from "./chunk-Y7G4VXR7.js";
19
+ import {
20
+ getUnitVectorFromDirection,
21
+ getUnitVectorFromPointAToB
22
+ } from "./chunk-GIGMPRPV.js";
11
23
  import {
12
24
  grid
13
25
  } from "./chunk-U45EKA3R.js";
@@ -19,24 +31,7 @@ import {
19
31
  midpoint,
20
32
  pointToBoundsDistance,
21
33
  pointToBoxDistance
22
- } from "./chunk-BLY7FZPX.js";
23
- import {
24
- clamp,
25
- computeDistanceBetweenBoxes,
26
- computeGapBetweenBoxes,
27
- computeManhattanDistanceBetweenBoxes,
28
- findNearestPointsBetweenBoxSets,
29
- getBoundingBox
30
- } from "./chunk-DRDDWFOS.js";
31
- import "./chunk-MTORG67J.js";
32
- import {
33
- areBoundsCompletelyInsidePolygon,
34
- areBoundsOverlappingPolygon,
35
- isPointInsideBounds,
36
- isPointInsidePolygon,
37
- isRectCompletelyInsidePolygon,
38
- isRectOverlappingPolygon
39
- } from "./chunk-6K6N6UTQ.js";
34
+ } from "./chunk-5J3PCV4D.js";
40
35
  import {
41
36
  distance,
42
37
  doSegmentsIntersect,
@@ -47,6 +42,15 @@ import {
47
42
  orientation,
48
43
  pointToSegmentDistance
49
44
  } from "./chunk-EFLPMB4J.js";
45
+ import {
46
+ clamp,
47
+ computeDistanceBetweenBoxes,
48
+ computeGapBetweenBoxes,
49
+ computeManhattanDistanceBetweenBoxes,
50
+ findNearestPointsBetweenBoxSets,
51
+ getBoundingBox
52
+ } from "./chunk-DRDDWFOS.js";
53
+ import "./chunk-MTORG67J.js";
50
54
  import {
51
55
  boundsAreaOverlap
52
56
  } from "./chunk-YA3GC5BB.js";
@@ -66,10 +70,6 @@ import {
66
70
  import {
67
71
  getBoundsFromPoints
68
72
  } from "./chunk-5N7UJNVK.js";
69
- import {
70
- getUnitVectorFromDirection,
71
- getUnitVectorFromPointAToB
72
- } from "./chunk-GIGMPRPV.js";
73
73
  export {
74
74
  areBoundsCompletelyInsidePolygon,
75
75
  areBoundsOverlappingPolygon,
@@ -3,9 +3,9 @@ import {
3
3
  midpoint,
4
4
  pointToBoundsDistance,
5
5
  pointToBoxDistance
6
- } from "./chunk-BLY7FZPX.js";
7
- import "./chunk-DRDDWFOS.js";
6
+ } from "./chunk-5J3PCV4D.js";
8
7
  import "./chunk-EFLPMB4J.js";
8
+ import "./chunk-DRDDWFOS.js";
9
9
  export {
10
10
  distSq,
11
11
  midpoint,
@@ -4,9 +4,9 @@ import {
4
4
  segmentToBoxMinDistance,
5
5
  segmentToCircleMinDistance,
6
6
  segmentToSegmentMinDistance
7
- } from "./chunk-6PD3WN3Y.js";
8
- import "./chunk-DRDDWFOS.js";
7
+ } from "./chunk-Y7G4VXR7.js";
9
8
  import "./chunk-EFLPMB4J.js";
9
+ import "./chunk-DRDDWFOS.js";
10
10
  export {
11
11
  pointToSegmentClosestPoint,
12
12
  segmentToBoundsMinDistance,
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.33",
4
+ "version": "0.0.34",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",