@rxflow/manhattan 0.0.1-alpha.0
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/README.md +35 -0
- package/cjs/geometry/Line.d.ts +21 -0
- package/cjs/geometry/Line.d.ts.map +1 -0
- package/cjs/geometry/Line.js +88 -0
- package/cjs/geometry/Point.d.ts +49 -0
- package/cjs/geometry/Point.d.ts.map +1 -0
- package/cjs/geometry/Point.js +94 -0
- package/cjs/geometry/Rectangle.d.ts +41 -0
- package/cjs/geometry/Rectangle.d.ts.map +1 -0
- package/cjs/geometry/Rectangle.js +65 -0
- package/cjs/geometry/index.d.ts +4 -0
- package/cjs/geometry/index.d.ts.map +1 -0
- package/cjs/geometry/index.js +26 -0
- package/cjs/getManHattanPath.d.ts +60 -0
- package/cjs/getManHattanPath.d.ts.map +1 -0
- package/cjs/getManHattanPath.js +285 -0
- package/cjs/index.d.ts +16 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +117 -0
- package/cjs/obstacle/ObstacleMap.d.ts +28 -0
- package/cjs/obstacle/ObstacleMap.d.ts.map +1 -0
- package/cjs/obstacle/ObstacleMap.js +171 -0
- package/cjs/obstacle/index.d.ts +2 -0
- package/cjs/obstacle/index.d.ts.map +1 -0
- package/cjs/obstacle/index.js +12 -0
- package/cjs/options/defaults.d.ts +16 -0
- package/cjs/options/defaults.d.ts.map +1 -0
- package/cjs/options/defaults.js +39 -0
- package/cjs/options/index.d.ts +4 -0
- package/cjs/options/index.d.ts.map +1 -0
- package/cjs/options/index.js +38 -0
- package/cjs/options/resolver.d.ts +10 -0
- package/cjs/options/resolver.d.ts.map +1 -0
- package/cjs/options/resolver.js +118 -0
- package/cjs/options/types.d.ts +156 -0
- package/cjs/options/types.d.ts.map +1 -0
- package/cjs/options/types.js +5 -0
- package/cjs/pathfinder/SortedSet.d.ts +35 -0
- package/cjs/pathfinder/SortedSet.d.ts.map +1 -0
- package/cjs/pathfinder/SortedSet.js +95 -0
- package/cjs/pathfinder/findRoute.d.ts +8 -0
- package/cjs/pathfinder/findRoute.d.ts.map +1 -0
- package/cjs/pathfinder/findRoute.js +156 -0
- package/cjs/pathfinder/index.d.ts +3 -0
- package/cjs/pathfinder/index.d.ts.map +1 -0
- package/cjs/pathfinder/index.js +19 -0
- package/cjs/svg/index.d.ts +2 -0
- package/cjs/svg/index.d.ts.map +1 -0
- package/cjs/svg/index.js +18 -0
- package/cjs/svg/pathConverter.d.ts +10 -0
- package/cjs/svg/pathConverter.d.ts.map +1 -0
- package/cjs/svg/pathConverter.js +105 -0
- package/cjs/utils/direction.d.ts +24 -0
- package/cjs/utils/direction.d.ts.map +1 -0
- package/cjs/utils/direction.js +54 -0
- package/cjs/utils/grid.d.ts +26 -0
- package/cjs/utils/grid.d.ts.map +1 -0
- package/cjs/utils/grid.js +78 -0
- package/cjs/utils/index.d.ts +6 -0
- package/cjs/utils/index.d.ts.map +1 -0
- package/cjs/utils/index.js +60 -0
- package/cjs/utils/node.d.ts +27 -0
- package/cjs/utils/node.d.ts.map +1 -0
- package/cjs/utils/node.js +36 -0
- package/cjs/utils/rect.d.ts +9 -0
- package/cjs/utils/rect.d.ts.map +1 -0
- package/cjs/utils/rect.js +103 -0
- package/cjs/utils/route.d.ts +19 -0
- package/cjs/utils/route.d.ts.map +1 -0
- package/cjs/utils/route.js +76 -0
- package/esm/geometry/Line.d.ts +21 -0
- package/esm/geometry/Line.d.ts.map +1 -0
- package/esm/geometry/Line.js +96 -0
- package/esm/geometry/Point.d.ts +49 -0
- package/esm/geometry/Point.d.ts.map +1 -0
- package/esm/geometry/Point.js +117 -0
- package/esm/geometry/Rectangle.d.ts +41 -0
- package/esm/geometry/Rectangle.d.ts.map +1 -0
- package/esm/geometry/Rectangle.js +81 -0
- package/esm/geometry/index.d.ts +4 -0
- package/esm/geometry/index.d.ts.map +1 -0
- package/esm/geometry/index.js +3 -0
- package/esm/getManHattanPath.d.ts +60 -0
- package/esm/getManHattanPath.d.ts.map +1 -0
- package/esm/getManHattanPath.js +291 -0
- package/esm/index.d.ts +16 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +24 -0
- package/esm/obstacle/ObstacleMap.d.ts +28 -0
- package/esm/obstacle/ObstacleMap.d.ts.map +1 -0
- package/esm/obstacle/ObstacleMap.js +183 -0
- package/esm/obstacle/index.d.ts +2 -0
- package/esm/obstacle/index.d.ts.map +1 -0
- package/esm/obstacle/index.js +1 -0
- package/esm/options/defaults.d.ts +16 -0
- package/esm/options/defaults.d.ts.map +1 -0
- package/esm/options/defaults.js +33 -0
- package/esm/options/index.d.ts +4 -0
- package/esm/options/index.d.ts.map +1 -0
- package/esm/options/index.js +3 -0
- package/esm/options/resolver.d.ts +10 -0
- package/esm/options/resolver.d.ts.map +1 -0
- package/esm/options/resolver.js +114 -0
- package/esm/options/types.d.ts +156 -0
- package/esm/options/types.d.ts.map +1 -0
- package/esm/options/types.js +1 -0
- package/esm/pathfinder/SortedSet.d.ts +35 -0
- package/esm/pathfinder/SortedSet.d.ts.map +1 -0
- package/esm/pathfinder/SortedSet.js +110 -0
- package/esm/pathfinder/findRoute.d.ts +8 -0
- package/esm/pathfinder/findRoute.d.ts.map +1 -0
- package/esm/pathfinder/findRoute.js +189 -0
- package/esm/pathfinder/index.d.ts +3 -0
- package/esm/pathfinder/index.d.ts.map +1 -0
- package/esm/pathfinder/index.js +2 -0
- package/esm/svg/index.d.ts +2 -0
- package/esm/svg/index.d.ts.map +1 -0
- package/esm/svg/index.js +1 -0
- package/esm/svg/pathConverter.d.ts +10 -0
- package/esm/svg/pathConverter.d.ts.map +1 -0
- package/esm/svg/pathConverter.js +107 -0
- package/esm/utils/direction.d.ts +24 -0
- package/esm/utils/direction.d.ts.map +1 -0
- package/esm/utils/direction.js +46 -0
- package/esm/utils/grid.d.ts +26 -0
- package/esm/utils/grid.d.ts.map +1 -0
- package/esm/utils/grid.js +70 -0
- package/esm/utils/index.d.ts +6 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +5 -0
- package/esm/utils/node.d.ts +27 -0
- package/esm/utils/node.d.ts.map +1 -0
- package/esm/utils/node.js +30 -0
- package/esm/utils/rect.d.ts +9 -0
- package/esm/utils/rect.d.ts.map +1 -0
- package/esm/utils/rect.js +121 -0
- package/esm/utils/route.d.ts +19 -0
- package/esm/utils/route.d.ts.map +1 -0
- package/esm/utils/route.js +80 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../src/utils/rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAQ,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AA6ClC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,SAAS,EAAE,EAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,eAAe,GACvB,KAAK,EAAE,CAsET"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRectPoints = getRectPoints;
|
|
7
|
+
var _geometry = require("../geometry");
|
|
8
|
+
var _grid = require("./grid");
|
|
9
|
+
/**
|
|
10
|
+
* Check if a point is on the edge of a rectangle
|
|
11
|
+
*/
|
|
12
|
+
function isPointOnRectangleEdge(point, bbox, tolerance = 0.01) {
|
|
13
|
+
const onLeft = Math.abs(point.x - bbox.x) < tolerance;
|
|
14
|
+
const onRight = Math.abs(point.x - (bbox.x + bbox.width)) < tolerance;
|
|
15
|
+
const onTop = Math.abs(point.y - bbox.y) < tolerance;
|
|
16
|
+
const onBottom = Math.abs(point.y - (bbox.y + bbox.height)) < tolerance;
|
|
17
|
+
const withinVerticalBounds = point.y >= bbox.y - tolerance && point.y <= bbox.y + bbox.height + tolerance;
|
|
18
|
+
const withinHorizontalBounds = point.x >= bbox.x - tolerance && point.x <= bbox.x + bbox.width + tolerance;
|
|
19
|
+
return (onLeft || onRight) && withinVerticalBounds || (onTop || onBottom) && withinHorizontalBounds;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Check if a direction points outward from the rectangle edge where the anchor is located
|
|
24
|
+
*/
|
|
25
|
+
function isDirectionOutward(anchor, bbox, direction, tolerance = 0.01) {
|
|
26
|
+
const onLeft = Math.abs(anchor.x - bbox.x) < tolerance;
|
|
27
|
+
const onRight = Math.abs(anchor.x - (bbox.x + bbox.width)) < tolerance;
|
|
28
|
+
const onTop = Math.abs(anchor.y - bbox.y) < tolerance;
|
|
29
|
+
const onBottom = Math.abs(anchor.y - (bbox.y + bbox.height)) < tolerance;
|
|
30
|
+
|
|
31
|
+
// Only allow outward directions from the edge
|
|
32
|
+
if (onLeft && direction.x < 0) return true;
|
|
33
|
+
if (onRight && direction.x > 0) return true;
|
|
34
|
+
if (onTop && direction.y < 0) return true;
|
|
35
|
+
if (onBottom && direction.y > 0) return true;
|
|
36
|
+
|
|
37
|
+
// For corners, allow both perpendicular directions
|
|
38
|
+
if ((onLeft || onRight) && direction.x === 0) return true;
|
|
39
|
+
if ((onTop || onBottom) && direction.y === 0) return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get points around a rectangle taking given directions into account
|
|
45
|
+
* Lines are drawn from anchor in given directions, intersections recorded
|
|
46
|
+
*/
|
|
47
|
+
function getRectPoints(anchor, bbox, directionList, grid, options) {
|
|
48
|
+
const precision = options.precision;
|
|
49
|
+
const directionMap = options.directionMap;
|
|
50
|
+
const centerVector = anchor.diff(bbox.getCenter());
|
|
51
|
+
const rectPoints = [];
|
|
52
|
+
|
|
53
|
+
// Check if anchor is on the edge of the bbox
|
|
54
|
+
const isOnEdge = isPointOnRectangleEdge(anchor, bbox);
|
|
55
|
+
|
|
56
|
+
// Check each allowed direction
|
|
57
|
+
for (const key of directionList) {
|
|
58
|
+
const direction = directionMap[key];
|
|
59
|
+
|
|
60
|
+
// If anchor is on edge, only consider outward directions
|
|
61
|
+
if (isOnEdge) {
|
|
62
|
+
const isOutward = isDirectionOutward(anchor, bbox, direction);
|
|
63
|
+
if (!isOutward) {
|
|
64
|
+
continue; // Skip inward directions
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Create a line that is guaranteed to intersect the bbox if bbox
|
|
69
|
+
// is in the direction even if anchor lies outside of bbox
|
|
70
|
+
const ending = new _geometry.Point(anchor.x + direction.x * (Math.abs(centerVector.x) + bbox.width), anchor.y + direction.y * (Math.abs(centerVector.y) + bbox.height));
|
|
71
|
+
const intersectionLine = new _geometry.Line(anchor, ending);
|
|
72
|
+
|
|
73
|
+
// Get the farther intersection, in case there are two
|
|
74
|
+
const intersections = intersectionLine.intersect(bbox);
|
|
75
|
+
let farthestIntersectionDistance;
|
|
76
|
+
let farthestIntersection = null;
|
|
77
|
+
for (const intersection of intersections) {
|
|
78
|
+
const distance = anchor.squaredDistance(intersection);
|
|
79
|
+
if (farthestIntersectionDistance === undefined || distance > farthestIntersectionDistance) {
|
|
80
|
+
farthestIntersectionDistance = distance;
|
|
81
|
+
farthestIntersection = intersection;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// If an intersection was found in this direction, it is our rectPoint
|
|
86
|
+
if (farthestIntersection) {
|
|
87
|
+
let target = (0, _grid.align)(farthestIntersection, grid, precision);
|
|
88
|
+
|
|
89
|
+
// If the rectPoint lies inside the bbox, offset it by one more step
|
|
90
|
+
if (bbox.containsPoint(target)) {
|
|
91
|
+
target = (0, _grid.align)(target.translate(direction.x * grid.x, direction.y * grid.y), grid, precision);
|
|
92
|
+
}
|
|
93
|
+
rectPoints.push(target);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// If anchor lies outside of bbox, add it to the array of points
|
|
98
|
+
// If anchor is on edge, don't add it - force path to start from extended points
|
|
99
|
+
if (!bbox.containsPoint(anchor) && !isOnEdge) {
|
|
100
|
+
rectPoints.push((0, _grid.align)(anchor, grid, precision));
|
|
101
|
+
}
|
|
102
|
+
return rectPoints;
|
|
103
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Point } from '../geometry';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize a point to a unit direction vector
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizePoint(point: Point): Point;
|
|
6
|
+
/**
|
|
7
|
+
* Get string key for a point
|
|
8
|
+
*/
|
|
9
|
+
export declare function getKey(point: Point): string;
|
|
10
|
+
/**
|
|
11
|
+
* Calculate minimum Manhattan distance from a point to multiple anchors
|
|
12
|
+
*/
|
|
13
|
+
export declare function getCost(from: Point, anchors: Point[]): number;
|
|
14
|
+
/**
|
|
15
|
+
* Reconstruct route by concatenating points with their parents
|
|
16
|
+
* Removes redundant points in the same direction
|
|
17
|
+
*/
|
|
18
|
+
export declare function reconstructRoute(parents: Map<string, Point>, points: Map<string, Point>, tailPoint: Point, startPoint: Point, endPoint: Point): Point[];
|
|
19
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/utils/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAKlD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAW7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAC3B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,GACd,KAAK,EAAE,CAsCT"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCost = getCost;
|
|
7
|
+
exports.getKey = getKey;
|
|
8
|
+
exports.normalizePoint = normalizePoint;
|
|
9
|
+
exports.reconstructRoute = reconstructRoute;
|
|
10
|
+
var _geometry = require("../geometry");
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a point to a unit direction vector
|
|
13
|
+
*/
|
|
14
|
+
function normalizePoint(point) {
|
|
15
|
+
return new _geometry.Point(point.x === 0 ? 0 : Math.abs(point.x) / point.x, point.y === 0 ? 0 : Math.abs(point.y) / point.y);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get string key for a point
|
|
20
|
+
*/
|
|
21
|
+
function getKey(point) {
|
|
22
|
+
return point.toString();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Calculate minimum Manhattan distance from a point to multiple anchors
|
|
27
|
+
*/
|
|
28
|
+
function getCost(from, anchors) {
|
|
29
|
+
let min = Infinity;
|
|
30
|
+
for (const anchor of anchors) {
|
|
31
|
+
const dist = from.manhattanDistance(anchor);
|
|
32
|
+
if (dist < min) {
|
|
33
|
+
min = dist;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return min;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Reconstruct route by concatenating points with their parents
|
|
41
|
+
* Removes redundant points in the same direction
|
|
42
|
+
*/
|
|
43
|
+
function reconstructRoute(parents, points, tailPoint, startPoint, endPoint) {
|
|
44
|
+
const route = [];
|
|
45
|
+
let prevDiff = normalizePoint(endPoint.diff(tailPoint));
|
|
46
|
+
|
|
47
|
+
// tailPoint is assumed to be aligned already
|
|
48
|
+
let currentKey = getKey(tailPoint);
|
|
49
|
+
let parent = parents.get(currentKey);
|
|
50
|
+
let point;
|
|
51
|
+
while (parent) {
|
|
52
|
+
// point is assumed to be aligned already
|
|
53
|
+
point = points.get(currentKey);
|
|
54
|
+
if (point) {
|
|
55
|
+
const diff = normalizePoint(point.diff(parent));
|
|
56
|
+
if (!diff.equals(prevDiff)) {
|
|
57
|
+
route.unshift(point);
|
|
58
|
+
prevDiff = diff;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// parent is assumed to be aligned already
|
|
63
|
+
currentKey = getKey(parent);
|
|
64
|
+
parent = parents.get(currentKey);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// leadPoint is assumed to be aligned already
|
|
68
|
+
const leadPoint = points.get(currentKey);
|
|
69
|
+
if (leadPoint) {
|
|
70
|
+
const fromDiff = normalizePoint(leadPoint.diff(startPoint));
|
|
71
|
+
if (!fromDiff.equals(prevDiff)) {
|
|
72
|
+
route.unshift(leadPoint);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return route;
|
|
76
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Point } from './Point';
|
|
2
|
+
import { Rectangle } from './Rectangle';
|
|
3
|
+
/**
|
|
4
|
+
* Line class representing a line segment
|
|
5
|
+
*/
|
|
6
|
+
export declare class Line {
|
|
7
|
+
start: Point;
|
|
8
|
+
end: Point;
|
|
9
|
+
constructor(start: Point, end: Point);
|
|
10
|
+
/**
|
|
11
|
+
* Calculate intersection points with a rectangle
|
|
12
|
+
* Returns an array of intersection points
|
|
13
|
+
*/
|
|
14
|
+
intersect(rect: Rectangle): Point[];
|
|
15
|
+
/**
|
|
16
|
+
* Calculate intersection point between two line segments
|
|
17
|
+
* Returns null if lines don't intersect
|
|
18
|
+
*/
|
|
19
|
+
private lineIntersection;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../src/geometry/Line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,qBAAa,IAAI;IACf,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,KAAK,CAAA;gBAEE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK;IAKpC;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE;IA+BnC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CA+BzB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { Point } from "./Point";
|
|
9
|
+
/**
|
|
10
|
+
* Line class representing a line segment
|
|
11
|
+
*/
|
|
12
|
+
export var Line = /*#__PURE__*/function () {
|
|
13
|
+
function Line(start, end) {
|
|
14
|
+
_classCallCheck(this, Line);
|
|
15
|
+
_defineProperty(this, "start", void 0);
|
|
16
|
+
_defineProperty(this, "end", void 0);
|
|
17
|
+
this.start = start;
|
|
18
|
+
this.end = end;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Calculate intersection points with a rectangle
|
|
23
|
+
* Returns an array of intersection points
|
|
24
|
+
*/
|
|
25
|
+
_createClass(Line, [{
|
|
26
|
+
key: "intersect",
|
|
27
|
+
value: function intersect(rect) {
|
|
28
|
+
var intersections = [];
|
|
29
|
+
|
|
30
|
+
// Define rectangle edges
|
|
31
|
+
var edges = [
|
|
32
|
+
// Top edge
|
|
33
|
+
{
|
|
34
|
+
p1: new Point(rect.x, rect.y),
|
|
35
|
+
p2: new Point(rect.x + rect.width, rect.y)
|
|
36
|
+
},
|
|
37
|
+
// Right edge
|
|
38
|
+
{
|
|
39
|
+
p1: new Point(rect.x + rect.width, rect.y),
|
|
40
|
+
p2: new Point(rect.x + rect.width, rect.y + rect.height)
|
|
41
|
+
},
|
|
42
|
+
// Bottom edge
|
|
43
|
+
{
|
|
44
|
+
p1: new Point(rect.x, rect.y + rect.height),
|
|
45
|
+
p2: new Point(rect.x + rect.width, rect.y + rect.height)
|
|
46
|
+
},
|
|
47
|
+
// Left edge
|
|
48
|
+
{
|
|
49
|
+
p1: new Point(rect.x, rect.y),
|
|
50
|
+
p2: new Point(rect.x, rect.y + rect.height)
|
|
51
|
+
}];
|
|
52
|
+
|
|
53
|
+
// Check intersection with each edge
|
|
54
|
+
for (var _i = 0, _edges = edges; _i < _edges.length; _i++) {
|
|
55
|
+
var edge = _edges[_i];
|
|
56
|
+
var intersection = this.lineIntersection(this.start, this.end, edge.p1, edge.p2);
|
|
57
|
+
if (intersection) {
|
|
58
|
+
intersections.push(intersection);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return intersections;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Calculate intersection point between two line segments
|
|
66
|
+
* Returns null if lines don't intersect
|
|
67
|
+
*/
|
|
68
|
+
}, {
|
|
69
|
+
key: "lineIntersection",
|
|
70
|
+
value: function lineIntersection(p1, p2, p3, p4) {
|
|
71
|
+
var x1 = p1.x,
|
|
72
|
+
y1 = p1.y;
|
|
73
|
+
var x2 = p2.x,
|
|
74
|
+
y2 = p2.y;
|
|
75
|
+
var x3 = p3.x,
|
|
76
|
+
y3 = p3.y;
|
|
77
|
+
var x4 = p4.x,
|
|
78
|
+
y4 = p4.y;
|
|
79
|
+
var denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
|
80
|
+
|
|
81
|
+
// Lines are parallel
|
|
82
|
+
if (Math.abs(denom) < 1e-10) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
var t = ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / denom;
|
|
86
|
+
var u = -((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / denom;
|
|
87
|
+
|
|
88
|
+
// Check if intersection is within both line segments
|
|
89
|
+
if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
|
|
90
|
+
return new Point(x1 + t * (x2 - x1), y1 + t * (y2 - y1));
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}]);
|
|
95
|
+
return Line;
|
|
96
|
+
}();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point class representing a 2D coordinate
|
|
3
|
+
*/
|
|
4
|
+
export declare class Point {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
constructor(x: number, y: number);
|
|
8
|
+
/**
|
|
9
|
+
* Create a copy of this point
|
|
10
|
+
*/
|
|
11
|
+
clone(): Point;
|
|
12
|
+
/**
|
|
13
|
+
* Check if this point equals another point
|
|
14
|
+
*/
|
|
15
|
+
equals(other: Point): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Translate this point by dx and dy
|
|
18
|
+
*/
|
|
19
|
+
translate(dx: number, dy: number): Point;
|
|
20
|
+
/**
|
|
21
|
+
* Round coordinates to specified precision
|
|
22
|
+
*/
|
|
23
|
+
round(precision: number): Point;
|
|
24
|
+
/**
|
|
25
|
+
* Calculate Manhattan distance to another point
|
|
26
|
+
*/
|
|
27
|
+
manhattanDistance(other: Point): number;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate angle (in degrees) from this point to another point
|
|
30
|
+
*/
|
|
31
|
+
theta(other: Point): number;
|
|
32
|
+
/**
|
|
33
|
+
* Calculate the difference vector from this point to another
|
|
34
|
+
*/
|
|
35
|
+
diff(other: Point): Point;
|
|
36
|
+
/**
|
|
37
|
+
* Convert point to string representation
|
|
38
|
+
*/
|
|
39
|
+
toString(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Snap point to grid
|
|
42
|
+
*/
|
|
43
|
+
snapToGrid(gridSize: number): Point;
|
|
44
|
+
/**
|
|
45
|
+
* Calculate squared distance to another point (for performance)
|
|
46
|
+
*/
|
|
47
|
+
squaredDistance(other: Point): number;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=Point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../src/geometry/Point.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,KAAK;IAChB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;gBAEG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACH,KAAK,IAAI,KAAK;IAId;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAI7B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK;IAIxC;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IAQ/B;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAIvC;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAO3B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAIzB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK;IAOnC;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;CAKtC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
/**
|
|
9
|
+
* Point class representing a 2D coordinate
|
|
10
|
+
*/
|
|
11
|
+
export var Point = /*#__PURE__*/function () {
|
|
12
|
+
function Point(x, y) {
|
|
13
|
+
_classCallCheck(this, Point);
|
|
14
|
+
_defineProperty(this, "x", void 0);
|
|
15
|
+
_defineProperty(this, "y", void 0);
|
|
16
|
+
this.x = x;
|
|
17
|
+
this.y = y;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create a copy of this point
|
|
22
|
+
*/
|
|
23
|
+
_createClass(Point, [{
|
|
24
|
+
key: "clone",
|
|
25
|
+
value: function clone() {
|
|
26
|
+
return new Point(this.x, this.y);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Check if this point equals another point
|
|
31
|
+
*/
|
|
32
|
+
}, {
|
|
33
|
+
key: "equals",
|
|
34
|
+
value: function equals(other) {
|
|
35
|
+
return this.x === other.x && this.y === other.y;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Translate this point by dx and dy
|
|
40
|
+
*/
|
|
41
|
+
}, {
|
|
42
|
+
key: "translate",
|
|
43
|
+
value: function translate(dx, dy) {
|
|
44
|
+
return new Point(this.x + dx, this.y + dy);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Round coordinates to specified precision
|
|
49
|
+
*/
|
|
50
|
+
}, {
|
|
51
|
+
key: "round",
|
|
52
|
+
value: function round(precision) {
|
|
53
|
+
var factor = Math.pow(10, precision);
|
|
54
|
+
return new Point(Math.round(this.x * factor) / factor, Math.round(this.y * factor) / factor);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Calculate Manhattan distance to another point
|
|
59
|
+
*/
|
|
60
|
+
}, {
|
|
61
|
+
key: "manhattanDistance",
|
|
62
|
+
value: function manhattanDistance(other) {
|
|
63
|
+
return Math.abs(this.x - other.x) + Math.abs(this.y - other.y);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Calculate angle (in degrees) from this point to another point
|
|
68
|
+
*/
|
|
69
|
+
}, {
|
|
70
|
+
key: "theta",
|
|
71
|
+
value: function theta(other) {
|
|
72
|
+
var dx = other.x - this.x;
|
|
73
|
+
var dy = other.y - this.y;
|
|
74
|
+
var radians = Math.atan2(dy, dx);
|
|
75
|
+
return radians * 180 / Math.PI;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Calculate the difference vector from this point to another
|
|
80
|
+
*/
|
|
81
|
+
}, {
|
|
82
|
+
key: "diff",
|
|
83
|
+
value: function diff(other) {
|
|
84
|
+
return new Point(other.x - this.x, other.y - this.y);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Convert point to string representation
|
|
89
|
+
*/
|
|
90
|
+
}, {
|
|
91
|
+
key: "toString",
|
|
92
|
+
value: function toString() {
|
|
93
|
+
return "".concat(this.x, "@").concat(this.y);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Snap point to grid
|
|
98
|
+
*/
|
|
99
|
+
}, {
|
|
100
|
+
key: "snapToGrid",
|
|
101
|
+
value: function snapToGrid(gridSize) {
|
|
102
|
+
return new Point(Math.round(this.x / gridSize) * gridSize, Math.round(this.y / gridSize) * gridSize);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Calculate squared distance to another point (for performance)
|
|
107
|
+
*/
|
|
108
|
+
}, {
|
|
109
|
+
key: "squaredDistance",
|
|
110
|
+
value: function squaredDistance(other) {
|
|
111
|
+
var dx = other.x - this.x;
|
|
112
|
+
var dy = other.y - this.y;
|
|
113
|
+
return dx * dx + dy * dy;
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
return Point;
|
|
117
|
+
}();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Point } from './Point';
|
|
2
|
+
/**
|
|
3
|
+
* Rectangle class representing a bounding box
|
|
4
|
+
*/
|
|
5
|
+
export declare class Rectangle {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
11
|
+
/**
|
|
12
|
+
* Create a copy of this rectangle
|
|
13
|
+
*/
|
|
14
|
+
clone(): Rectangle;
|
|
15
|
+
/**
|
|
16
|
+
* Get the center point of the rectangle
|
|
17
|
+
*/
|
|
18
|
+
getCenter(): Point;
|
|
19
|
+
/**
|
|
20
|
+
* Get the origin (top-left) point of the rectangle
|
|
21
|
+
*/
|
|
22
|
+
getOrigin(): Point;
|
|
23
|
+
/**
|
|
24
|
+
* Get the corner (bottom-right) point of the rectangle
|
|
25
|
+
*/
|
|
26
|
+
getCorner(): Point;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a point is contained within this rectangle
|
|
29
|
+
*/
|
|
30
|
+
containsPoint(point: Point): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Move and expand the rectangle by a box offset
|
|
33
|
+
*/
|
|
34
|
+
moveAndExpand(box: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
}): Rectangle;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=Rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../src/geometry/Rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;GAEG;AACH,qBAAa,SAAS;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;gBAEF,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO/D;;OAEG;IACH,KAAK,IAAI,SAAS;IAIlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAOlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAIlB;;OAEG;IACH,SAAS,IAAI,KAAK;IAIlB;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IASpC;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;CAQvF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { Point } from "./Point";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Rectangle class representing a bounding box
|
|
12
|
+
*/
|
|
13
|
+
export var Rectangle = /*#__PURE__*/function () {
|
|
14
|
+
function Rectangle(x, y, width, height) {
|
|
15
|
+
_classCallCheck(this, Rectangle);
|
|
16
|
+
_defineProperty(this, "x", void 0);
|
|
17
|
+
_defineProperty(this, "y", void 0);
|
|
18
|
+
_defineProperty(this, "width", void 0);
|
|
19
|
+
_defineProperty(this, "height", void 0);
|
|
20
|
+
this.x = x;
|
|
21
|
+
this.y = y;
|
|
22
|
+
this.width = width;
|
|
23
|
+
this.height = height;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create a copy of this rectangle
|
|
28
|
+
*/
|
|
29
|
+
_createClass(Rectangle, [{
|
|
30
|
+
key: "clone",
|
|
31
|
+
value: function clone() {
|
|
32
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the center point of the rectangle
|
|
37
|
+
*/
|
|
38
|
+
}, {
|
|
39
|
+
key: "getCenter",
|
|
40
|
+
value: function getCenter() {
|
|
41
|
+
return new Point(this.x + this.width / 2, this.y + this.height / 2);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get the origin (top-left) point of the rectangle
|
|
46
|
+
*/
|
|
47
|
+
}, {
|
|
48
|
+
key: "getOrigin",
|
|
49
|
+
value: function getOrigin() {
|
|
50
|
+
return new Point(this.x, this.y);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the corner (bottom-right) point of the rectangle
|
|
55
|
+
*/
|
|
56
|
+
}, {
|
|
57
|
+
key: "getCorner",
|
|
58
|
+
value: function getCorner() {
|
|
59
|
+
return new Point(this.x + this.width, this.y + this.height);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Check if a point is contained within this rectangle
|
|
64
|
+
*/
|
|
65
|
+
}, {
|
|
66
|
+
key: "containsPoint",
|
|
67
|
+
value: function containsPoint(point) {
|
|
68
|
+
return point.x >= this.x && point.x <= this.x + this.width && point.y >= this.y && point.y <= this.y + this.height;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Move and expand the rectangle by a box offset
|
|
73
|
+
*/
|
|
74
|
+
}, {
|
|
75
|
+
key: "moveAndExpand",
|
|
76
|
+
value: function moveAndExpand(box) {
|
|
77
|
+
return new Rectangle(this.x + box.x, this.y + box.y, this.width + box.width, this.height + box.height);
|
|
78
|
+
}
|
|
79
|
+
}]);
|
|
80
|
+
return Rectangle;
|
|
81
|
+
}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|