rendx-bounding 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present wei.liang (https://github.com/weiliang0121)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/main.cjs ADDED
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/main.ts
21
+ var main_exports = {};
22
+ __export(main_exports, {
23
+ BoundingBox: () => BoundingBox
24
+ });
25
+ module.exports = __toCommonJS(main_exports);
26
+
27
+ // src/box.ts
28
+ var BoundingBox = class _BoundingBox {
29
+ constructor() {
30
+ this.x = 0;
31
+ this.y = 0;
32
+ this.width = 0;
33
+ this.height = 0;
34
+ }
35
+ // ── 静态工厂 ────────────────────────────────────────
36
+ /** 从 x, y, width, height 创建包围盒 */
37
+ static fromRect(x, y, width, height) {
38
+ const b = new _BoundingBox();
39
+ b.x = x;
40
+ b.y = y;
41
+ b.width = width;
42
+ b.height = height;
43
+ return b;
44
+ }
45
+ /** 从两个对角点 (x1,y1), (x2,y2) 创建包围盒 */
46
+ static fromPoints(x1, y1, x2, y2) {
47
+ return _BoundingBox.fromRect(x1, y1, x2 - x1, y2 - y1);
48
+ }
49
+ // ── 计算属性 ────────────────────────────────────────
50
+ /** 中心 X */
51
+ get cx() {
52
+ return this.x + this.width / 2;
53
+ }
54
+ /** 中心 Y */
55
+ get cy() {
56
+ return this.y + this.height / 2;
57
+ }
58
+ /** 内切圆半径 */
59
+ get radius() {
60
+ return Math.min(this.width, this.height) / 2;
61
+ }
62
+ /** 宽高比 h/w */
63
+ get aspect() {
64
+ return this.height / this.width;
65
+ }
66
+ /** 右边界 */
67
+ get right() {
68
+ return this.x + this.width;
69
+ }
70
+ /** 下边界 */
71
+ get bottom() {
72
+ return this.y + this.height;
73
+ }
74
+ /** 面积 */
75
+ get area() {
76
+ return this.width * this.height;
77
+ }
78
+ /** 是否为空(宽或高 ≤ 0) */
79
+ get empty() {
80
+ return this.width <= 0 || this.height <= 0;
81
+ }
82
+ // ── 设值 ────────────────────────────────────────────
83
+ /** 设置 x, y, width, height */
84
+ set(x, y, width, height) {
85
+ this.x = x;
86
+ this.y = y;
87
+ this.width = width;
88
+ this.height = height;
89
+ return this;
90
+ }
91
+ /** 深拷贝 */
92
+ copy() {
93
+ return _BoundingBox.fromRect(this.x, this.y, this.width, this.height);
94
+ }
95
+ /** 转为 [x, y, width, height] 元组 */
96
+ toArray() {
97
+ return [this.x, this.y, this.width, this.height];
98
+ }
99
+ // ── 空间查询 ────────────────────────────────────────
100
+ /** 点 (px, py) 是否在包围盒内 */
101
+ containsPoint(px, py) {
102
+ return px >= this.x && px <= this.right && py >= this.y && py <= this.bottom;
103
+ }
104
+ /**
105
+ * 点是否在包围盒内
106
+ * @deprecated 使用 containsPoint 代替
107
+ */
108
+ in(px, py) {
109
+ return this.containsPoint(px, py);
110
+ }
111
+ /** 是否完全包含另一个包围盒 */
112
+ containsBox(box) {
113
+ return this.x <= box.x && this.right >= box.right && this.y <= box.y && this.bottom >= box.bottom;
114
+ }
115
+ /** 是否与另一个包围盒相交 */
116
+ intersects(box) {
117
+ return this.x < box.right && this.right > box.x && this.y < box.bottom && this.bottom > box.y;
118
+ }
119
+ // ── 变换(返回新实例) ──────────────────────────────
120
+ /** 与另一个包围盒求交集 */
121
+ intersection(box) {
122
+ const x0 = Math.max(this.x, box.x);
123
+ const y0 = Math.max(this.y, box.y);
124
+ const x1 = Math.min(this.right, box.right);
125
+ const y1 = Math.min(this.bottom, box.bottom);
126
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
127
+ }
128
+ /** 与另一个包围盒求并集 */
129
+ union(box) {
130
+ const x0 = Math.min(this.x, box.x);
131
+ const y0 = Math.min(this.y, box.y);
132
+ const x1 = Math.max(this.right, box.right);
133
+ const y1 = Math.max(this.bottom, box.bottom);
134
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
135
+ }
136
+ /** 扩展到包含点 (px, py) */
137
+ expandPoint(px, py) {
138
+ const x0 = Math.min(this.x, px);
139
+ const y0 = Math.min(this.y, py);
140
+ const x1 = Math.max(this.right, px);
141
+ const y1 = Math.max(this.bottom, py);
142
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
143
+ }
144
+ /**
145
+ * 四边内缩/外扩
146
+ * @param padding - [top, right, bottom, left]
147
+ * @param outward - true 为外扩,false 为内缩(默认)
148
+ */
149
+ pad(padding, outward = false) {
150
+ const [t, r, b, l] = padding;
151
+ if (outward) return _BoundingBox.fromRect(this.x - l, this.y - t, this.width + l + r, this.height + t + b);
152
+ return _BoundingBox.fromRect(this.x + l, this.y + t, this.width - l - r, this.height - t - b);
153
+ }
154
+ /** 全局坐标转本地坐标 */
155
+ localXY(px, py) {
156
+ return [px - this.x, py - this.y];
157
+ }
158
+ // ── 分割 ────────────────────────────────────────────
159
+ /** X 向等分,返回第 index 个子区域 */
160
+ divideX(count, index) {
161
+ const w = this.width / count;
162
+ return _BoundingBox.fromRect(this.x + w * index, this.y, w, this.height);
163
+ }
164
+ /** Y 向等分,返回第 index 个子区域 */
165
+ divideY(count, index) {
166
+ const h = this.height / count;
167
+ return _BoundingBox.fromRect(this.x, this.y + h * index, this.width, h);
168
+ }
169
+ /**
170
+ * 按 scale 函数 X 向分割
171
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
172
+ * @param index - 分割索引
173
+ */
174
+ divideXByScale(scale, index) {
175
+ const x0 = scale.scale(index);
176
+ return _BoundingBox.fromRect(x0, this.y, scale.bandwidth, this.height);
177
+ }
178
+ /**
179
+ * 按 scale 函数 Y 向分割
180
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
181
+ * @param index - 分割索引
182
+ */
183
+ divideYByScale(scale, index) {
184
+ const y0 = scale.scale(index);
185
+ return _BoundingBox.fromRect(this.x, y0, this.width, scale.bandwidth);
186
+ }
187
+ /** 返回四顶点 [[x0,y0], [x0,y1], [x1,y1], [x1,y0]] */
188
+ vertices() {
189
+ const r = this.right;
190
+ const b = this.bottom;
191
+ return [
192
+ [this.x, this.y],
193
+ [this.x, b],
194
+ [r, b],
195
+ [r, this.y]
196
+ ];
197
+ }
198
+ };
199
+ // Annotate the CommonJS export names for ESM import in node:
200
+ 0 && (module.exports = {
201
+ BoundingBox
202
+ });
@@ -0,0 +1,87 @@
1
+ /**
2
+ * 轴对齐包围盒(AABB)
3
+ * 核心数据结构:x, y, width, height
4
+ */
5
+ declare class BoundingBox {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ /** 从 x, y, width, height 创建包围盒 */
11
+ static fromRect(x: number, y: number, width: number, height: number): BoundingBox;
12
+ /** 从两个对角点 (x1,y1), (x2,y2) 创建包围盒 */
13
+ static fromPoints(x1: number, y1: number, x2: number, y2: number): BoundingBox;
14
+ /** 中心 X */
15
+ get cx(): number;
16
+ /** 中心 Y */
17
+ get cy(): number;
18
+ /** 内切圆半径 */
19
+ get radius(): number;
20
+ /** 宽高比 h/w */
21
+ get aspect(): number;
22
+ /** 右边界 */
23
+ get right(): number;
24
+ /** 下边界 */
25
+ get bottom(): number;
26
+ /** 面积 */
27
+ get area(): number;
28
+ /** 是否为空(宽或高 ≤ 0) */
29
+ get empty(): boolean;
30
+ /** 设置 x, y, width, height */
31
+ set(x: number, y: number, width: number, height: number): this;
32
+ /** 深拷贝 */
33
+ copy(): BoundingBox;
34
+ /** 转为 [x, y, width, height] 元组 */
35
+ toArray(): [number, number, number, number];
36
+ /** 点 (px, py) 是否在包围盒内 */
37
+ containsPoint(px: number, py: number): boolean;
38
+ /**
39
+ * 点是否在包围盒内
40
+ * @deprecated 使用 containsPoint 代替
41
+ */
42
+ in(px: number, py: number): boolean;
43
+ /** 是否完全包含另一个包围盒 */
44
+ containsBox(box: BoundingBox): boolean;
45
+ /** 是否与另一个包围盒相交 */
46
+ intersects(box: BoundingBox): boolean;
47
+ /** 与另一个包围盒求交集 */
48
+ intersection(box: BoundingBox): BoundingBox;
49
+ /** 与另一个包围盒求并集 */
50
+ union(box: BoundingBox): BoundingBox;
51
+ /** 扩展到包含点 (px, py) */
52
+ expandPoint(px: number, py: number): BoundingBox;
53
+ /**
54
+ * 四边内缩/外扩
55
+ * @param padding - [top, right, bottom, left]
56
+ * @param outward - true 为外扩,false 为内缩(默认)
57
+ */
58
+ pad(padding: [number, number, number, number], outward?: boolean): BoundingBox;
59
+ /** 全局坐标转本地坐标 */
60
+ localXY(px: number, py: number): [number, number];
61
+ /** X 向等分,返回第 index 个子区域 */
62
+ divideX(count: number, index: number): BoundingBox;
63
+ /** Y 向等分,返回第 index 个子区域 */
64
+ divideY(count: number, index: number): BoundingBox;
65
+ /**
66
+ * 按 scale 函数 X 向分割
67
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
68
+ * @param index - 分割索引
69
+ */
70
+ divideXByScale(scale: {
71
+ scale: (i: number) => number;
72
+ bandwidth: number;
73
+ }, index: number): BoundingBox;
74
+ /**
75
+ * 按 scale 函数 Y 向分割
76
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
77
+ * @param index - 分割索引
78
+ */
79
+ divideYByScale(scale: {
80
+ scale: (i: number) => number;
81
+ bandwidth: number;
82
+ }, index: number): BoundingBox;
83
+ /** 返回四顶点 [[x0,y0], [x0,y1], [x1,y1], [x1,y0]] */
84
+ vertices(): [[number, number], [number, number], [number, number], [number, number]];
85
+ }
86
+
87
+ export { BoundingBox };
package/dist/main.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ /**
2
+ * 轴对齐包围盒(AABB)
3
+ * 核心数据结构:x, y, width, height
4
+ */
5
+ declare class BoundingBox {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ /** 从 x, y, width, height 创建包围盒 */
11
+ static fromRect(x: number, y: number, width: number, height: number): BoundingBox;
12
+ /** 从两个对角点 (x1,y1), (x2,y2) 创建包围盒 */
13
+ static fromPoints(x1: number, y1: number, x2: number, y2: number): BoundingBox;
14
+ /** 中心 X */
15
+ get cx(): number;
16
+ /** 中心 Y */
17
+ get cy(): number;
18
+ /** 内切圆半径 */
19
+ get radius(): number;
20
+ /** 宽高比 h/w */
21
+ get aspect(): number;
22
+ /** 右边界 */
23
+ get right(): number;
24
+ /** 下边界 */
25
+ get bottom(): number;
26
+ /** 面积 */
27
+ get area(): number;
28
+ /** 是否为空(宽或高 ≤ 0) */
29
+ get empty(): boolean;
30
+ /** 设置 x, y, width, height */
31
+ set(x: number, y: number, width: number, height: number): this;
32
+ /** 深拷贝 */
33
+ copy(): BoundingBox;
34
+ /** 转为 [x, y, width, height] 元组 */
35
+ toArray(): [number, number, number, number];
36
+ /** 点 (px, py) 是否在包围盒内 */
37
+ containsPoint(px: number, py: number): boolean;
38
+ /**
39
+ * 点是否在包围盒内
40
+ * @deprecated 使用 containsPoint 代替
41
+ */
42
+ in(px: number, py: number): boolean;
43
+ /** 是否完全包含另一个包围盒 */
44
+ containsBox(box: BoundingBox): boolean;
45
+ /** 是否与另一个包围盒相交 */
46
+ intersects(box: BoundingBox): boolean;
47
+ /** 与另一个包围盒求交集 */
48
+ intersection(box: BoundingBox): BoundingBox;
49
+ /** 与另一个包围盒求并集 */
50
+ union(box: BoundingBox): BoundingBox;
51
+ /** 扩展到包含点 (px, py) */
52
+ expandPoint(px: number, py: number): BoundingBox;
53
+ /**
54
+ * 四边内缩/外扩
55
+ * @param padding - [top, right, bottom, left]
56
+ * @param outward - true 为外扩,false 为内缩(默认)
57
+ */
58
+ pad(padding: [number, number, number, number], outward?: boolean): BoundingBox;
59
+ /** 全局坐标转本地坐标 */
60
+ localXY(px: number, py: number): [number, number];
61
+ /** X 向等分,返回第 index 个子区域 */
62
+ divideX(count: number, index: number): BoundingBox;
63
+ /** Y 向等分,返回第 index 个子区域 */
64
+ divideY(count: number, index: number): BoundingBox;
65
+ /**
66
+ * 按 scale 函数 X 向分割
67
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
68
+ * @param index - 分割索引
69
+ */
70
+ divideXByScale(scale: {
71
+ scale: (i: number) => number;
72
+ bandwidth: number;
73
+ }, index: number): BoundingBox;
74
+ /**
75
+ * 按 scale 函数 Y 向分割
76
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
77
+ * @param index - 分割索引
78
+ */
79
+ divideYByScale(scale: {
80
+ scale: (i: number) => number;
81
+ bandwidth: number;
82
+ }, index: number): BoundingBox;
83
+ /** 返回四顶点 [[x0,y0], [x0,y1], [x1,y1], [x1,y0]] */
84
+ vertices(): [[number, number], [number, number], [number, number], [number, number]];
85
+ }
86
+
87
+ export { BoundingBox };
package/dist/main.js ADDED
@@ -0,0 +1,175 @@
1
+ // src/box.ts
2
+ var BoundingBox = class _BoundingBox {
3
+ constructor() {
4
+ this.x = 0;
5
+ this.y = 0;
6
+ this.width = 0;
7
+ this.height = 0;
8
+ }
9
+ // ── 静态工厂 ────────────────────────────────────────
10
+ /** 从 x, y, width, height 创建包围盒 */
11
+ static fromRect(x, y, width, height) {
12
+ const b = new _BoundingBox();
13
+ b.x = x;
14
+ b.y = y;
15
+ b.width = width;
16
+ b.height = height;
17
+ return b;
18
+ }
19
+ /** 从两个对角点 (x1,y1), (x2,y2) 创建包围盒 */
20
+ static fromPoints(x1, y1, x2, y2) {
21
+ return _BoundingBox.fromRect(x1, y1, x2 - x1, y2 - y1);
22
+ }
23
+ // ── 计算属性 ────────────────────────────────────────
24
+ /** 中心 X */
25
+ get cx() {
26
+ return this.x + this.width / 2;
27
+ }
28
+ /** 中心 Y */
29
+ get cy() {
30
+ return this.y + this.height / 2;
31
+ }
32
+ /** 内切圆半径 */
33
+ get radius() {
34
+ return Math.min(this.width, this.height) / 2;
35
+ }
36
+ /** 宽高比 h/w */
37
+ get aspect() {
38
+ return this.height / this.width;
39
+ }
40
+ /** 右边界 */
41
+ get right() {
42
+ return this.x + this.width;
43
+ }
44
+ /** 下边界 */
45
+ get bottom() {
46
+ return this.y + this.height;
47
+ }
48
+ /** 面积 */
49
+ get area() {
50
+ return this.width * this.height;
51
+ }
52
+ /** 是否为空(宽或高 ≤ 0) */
53
+ get empty() {
54
+ return this.width <= 0 || this.height <= 0;
55
+ }
56
+ // ── 设值 ────────────────────────────────────────────
57
+ /** 设置 x, y, width, height */
58
+ set(x, y, width, height) {
59
+ this.x = x;
60
+ this.y = y;
61
+ this.width = width;
62
+ this.height = height;
63
+ return this;
64
+ }
65
+ /** 深拷贝 */
66
+ copy() {
67
+ return _BoundingBox.fromRect(this.x, this.y, this.width, this.height);
68
+ }
69
+ /** 转为 [x, y, width, height] 元组 */
70
+ toArray() {
71
+ return [this.x, this.y, this.width, this.height];
72
+ }
73
+ // ── 空间查询 ────────────────────────────────────────
74
+ /** 点 (px, py) 是否在包围盒内 */
75
+ containsPoint(px, py) {
76
+ return px >= this.x && px <= this.right && py >= this.y && py <= this.bottom;
77
+ }
78
+ /**
79
+ * 点是否在包围盒内
80
+ * @deprecated 使用 containsPoint 代替
81
+ */
82
+ in(px, py) {
83
+ return this.containsPoint(px, py);
84
+ }
85
+ /** 是否完全包含另一个包围盒 */
86
+ containsBox(box) {
87
+ return this.x <= box.x && this.right >= box.right && this.y <= box.y && this.bottom >= box.bottom;
88
+ }
89
+ /** 是否与另一个包围盒相交 */
90
+ intersects(box) {
91
+ return this.x < box.right && this.right > box.x && this.y < box.bottom && this.bottom > box.y;
92
+ }
93
+ // ── 变换(返回新实例) ──────────────────────────────
94
+ /** 与另一个包围盒求交集 */
95
+ intersection(box) {
96
+ const x0 = Math.max(this.x, box.x);
97
+ const y0 = Math.max(this.y, box.y);
98
+ const x1 = Math.min(this.right, box.right);
99
+ const y1 = Math.min(this.bottom, box.bottom);
100
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
101
+ }
102
+ /** 与另一个包围盒求并集 */
103
+ union(box) {
104
+ const x0 = Math.min(this.x, box.x);
105
+ const y0 = Math.min(this.y, box.y);
106
+ const x1 = Math.max(this.right, box.right);
107
+ const y1 = Math.max(this.bottom, box.bottom);
108
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
109
+ }
110
+ /** 扩展到包含点 (px, py) */
111
+ expandPoint(px, py) {
112
+ const x0 = Math.min(this.x, px);
113
+ const y0 = Math.min(this.y, py);
114
+ const x1 = Math.max(this.right, px);
115
+ const y1 = Math.max(this.bottom, py);
116
+ return _BoundingBox.fromRect(x0, y0, x1 - x0, y1 - y0);
117
+ }
118
+ /**
119
+ * 四边内缩/外扩
120
+ * @param padding - [top, right, bottom, left]
121
+ * @param outward - true 为外扩,false 为内缩(默认)
122
+ */
123
+ pad(padding, outward = false) {
124
+ const [t, r, b, l] = padding;
125
+ if (outward) return _BoundingBox.fromRect(this.x - l, this.y - t, this.width + l + r, this.height + t + b);
126
+ return _BoundingBox.fromRect(this.x + l, this.y + t, this.width - l - r, this.height - t - b);
127
+ }
128
+ /** 全局坐标转本地坐标 */
129
+ localXY(px, py) {
130
+ return [px - this.x, py - this.y];
131
+ }
132
+ // ── 分割 ────────────────────────────────────────────
133
+ /** X 向等分,返回第 index 个子区域 */
134
+ divideX(count, index) {
135
+ const w = this.width / count;
136
+ return _BoundingBox.fromRect(this.x + w * index, this.y, w, this.height);
137
+ }
138
+ /** Y 向等分,返回第 index 个子区域 */
139
+ divideY(count, index) {
140
+ const h = this.height / count;
141
+ return _BoundingBox.fromRect(this.x, this.y + h * index, this.width, h);
142
+ }
143
+ /**
144
+ * 按 scale 函数 X 向分割
145
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
146
+ * @param index - 分割索引
147
+ */
148
+ divideXByScale(scale, index) {
149
+ const x0 = scale.scale(index);
150
+ return _BoundingBox.fromRect(x0, this.y, scale.bandwidth, this.height);
151
+ }
152
+ /**
153
+ * 按 scale 函数 Y 向分割
154
+ * @param scale - 含 scale() 和 bandwidth 的序数比例尺
155
+ * @param index - 分割索引
156
+ */
157
+ divideYByScale(scale, index) {
158
+ const y0 = scale.scale(index);
159
+ return _BoundingBox.fromRect(this.x, y0, this.width, scale.bandwidth);
160
+ }
161
+ /** 返回四顶点 [[x0,y0], [x0,y1], [x1,y1], [x1,y0]] */
162
+ vertices() {
163
+ const r = this.right;
164
+ const b = this.bottom;
165
+ return [
166
+ [this.x, this.y],
167
+ [this.x, b],
168
+ [r, b],
169
+ [r, this.y]
170
+ ];
171
+ }
172
+ };
173
+ export {
174
+ BoundingBox
175
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "rendx-bounding",
3
+ "version": "0.1.0",
4
+ "description": "Bounding box computation utilities",
5
+ "license": "MIT",
6
+ "author": "wei.liang (https://github.com/weiliang0121)",
7
+ "type": "module",
8
+ "keywords": [
9
+ "rendx",
10
+ "2d",
11
+ "canvas",
12
+ "rendering",
13
+ "visualization",
14
+ "scene-graph"
15
+ ],
16
+ "homepage": "https://weiliang0121.github.io/rendx/",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/weiliang0121/rendx.git",
20
+ "directory": "packages/bounding"
21
+ },
22
+ "main": "dist/main.cjs",
23
+ "module": "dist/main.js",
24
+ "types": "dist/main.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/main.d.ts",
28
+ "import": "./dist/main.js",
29
+ "require": "./dist/main.cjs"
30
+ }
31
+ },
32
+ "sideEffects": false,
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup",
41
+ "dev": "tsup --watch"
42
+ }
43
+ }