@tscircuit/math-utils 0.0.33 → 0.0.35
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.
- package/dist/{chunk-BLY7FZPX.js → chunk-5J3PCV4D.js} +4 -4
- package/dist/chunk-MIHKSXJY.js +17 -0
- package/dist/chunk-MIHKSXJY.js.map +1 -0
- package/dist/{chunk-6PD3WN3Y.js → chunk-Y7G4VXR7.js} +4 -4
- package/dist/get-bound-from-centered-rect.d.ts +14 -0
- package/dist/get-bound-from-centered-rect.js +7 -0
- package/dist/get-bound-from-centered-rect.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +27 -23
- package/dist/point-distance.js +2 -2
- package/dist/segment-distance.js +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-BLY7FZPX.js.map → chunk-5J3PCV4D.js.map} +0 -0
- /package/dist/{chunk-6PD3WN3Y.js.map → chunk-Y7G4VXR7.js.map} +0 -0
|
@@ -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-
|
|
49
|
+
//# sourceMappingURL=chunk-5J3PCV4D.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
|
|
14
|
+
export {
|
|
15
|
+
getBoundFromCenteredRect
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-MIHKSXJY.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":[]}
|
|
@@ -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-
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export { Polygon, areBoundsCompletelyInsidePolygon, areBoundsOverlappingPolygon,
|
|
|
15
15
|
export { normalizeDegrees } from './normalize-degrees.js';
|
|
16
16
|
export { getBoundsFromPoints } from './get-bounds-from-points.js';
|
|
17
17
|
export { getBoundsCenter } from './get-bounds-center.js';
|
|
18
|
+
export { getBoundFromCenteredRect } from './get-bound-from-centered-rect.js';
|
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-
|
|
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-
|
|
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";
|
|
@@ -60,16 +64,15 @@ import {
|
|
|
60
64
|
doBoundsOverlap
|
|
61
65
|
} from "./chunk-CA5ORSO4.js";
|
|
62
66
|
import "./chunk-GYQ2KZV6.js";
|
|
67
|
+
import {
|
|
68
|
+
getBoundFromCenteredRect
|
|
69
|
+
} from "./chunk-MIHKSXJY.js";
|
|
63
70
|
import {
|
|
64
71
|
getBoundsCenter
|
|
65
72
|
} from "./chunk-3WCUPG5S.js";
|
|
66
73
|
import {
|
|
67
74
|
getBoundsFromPoints
|
|
68
75
|
} from "./chunk-5N7UJNVK.js";
|
|
69
|
-
import {
|
|
70
|
-
getUnitVectorFromDirection,
|
|
71
|
-
getUnitVectorFromPointAToB
|
|
72
|
-
} from "./chunk-GIGMPRPV.js";
|
|
73
76
|
export {
|
|
74
77
|
areBoundsCompletelyInsidePolygon,
|
|
75
78
|
areBoundsOverlappingPolygon,
|
|
@@ -87,6 +90,7 @@ export {
|
|
|
87
90
|
doesLineIntersectLine,
|
|
88
91
|
doesSegmentIntersectRect,
|
|
89
92
|
findNearestPointsBetweenBoxSets,
|
|
93
|
+
getBoundFromCenteredRect,
|
|
90
94
|
getBoundingBox,
|
|
91
95
|
getBoundsCenter,
|
|
92
96
|
getBoundsFromPoints,
|
package/dist/point-distance.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
midpoint,
|
|
4
4
|
pointToBoundsDistance,
|
|
5
5
|
pointToBoxDistance
|
|
6
|
-
} from "./chunk-
|
|
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,
|
package/dist/segment-distance.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
segmentToBoxMinDistance,
|
|
5
5
|
segmentToCircleMinDistance,
|
|
6
6
|
segmentToSegmentMinDistance
|
|
7
|
-
} from "./chunk-
|
|
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
|
File without changes
|
|
File without changes
|