@edv4h/usketch-shape-utils 2.0.3 → 2.1.1
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/free-position.d.ts +24 -0
- package/dist/free-position.d.ts.map +1 -0
- package/dist/free-position.js +124 -0
- package/dist/free-position.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BoundingBox } from "@edv4h/usketch-shared";
|
|
2
|
+
export type FreePositionStrategy = "ring" | "push";
|
|
3
|
+
export interface FindFreePositionOptions {
|
|
4
|
+
/** 置きたい位置・サイズ(回転 shape は回転後 AABB を渡す)。 */
|
|
5
|
+
desired: BoundingBox;
|
|
6
|
+
/** 避ける矩形(回転後 AABB)。 */
|
|
7
|
+
occupied: BoundingBox[];
|
|
8
|
+
/** 探索戦略(既定 "ring")。 */
|
|
9
|
+
strategy?: FreePositionStrategy;
|
|
10
|
+
/** ring の半径刻み(world px、既定 20)。 */
|
|
11
|
+
step?: number;
|
|
12
|
+
/** ring の探索上限距離(world px、既定 2000)。超過時は best-effort。 */
|
|
13
|
+
maxDistance?: number;
|
|
14
|
+
/** push の反復上限(既定 50)。 */
|
|
15
|
+
maxIterations?: number;
|
|
16
|
+
}
|
|
17
|
+
/** box がいずれかの occupied と重なるか。 */
|
|
18
|
+
export declare function overlapsAny(box: BoundingBox, occupied: BoundingBox[]): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* `desired` に最も近い、occupied と重ならない位置(同サイズ)を返す。
|
|
21
|
+
* `desired` がそのまま空いていればそのまま返す。
|
|
22
|
+
*/
|
|
23
|
+
export declare function findFreePosition(opts: FindFreePositionOptions): BoundingBox;
|
|
24
|
+
//# sourceMappingURL=free-position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free-position.d.ts","sourceRoot":"","sources":["../src/free-position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACvC,0CAA0C;IAC1C,OAAO,EAAE,WAAW,CAAC;IACrB,uBAAuB;IACvB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAkBD,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAG9E;AAqFD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,WAAW,CAoB3E"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const EPS = 0.01;
|
|
2
|
+
/**
|
|
3
|
+
* 2つの AABB が重なるか。`collision-utils.intersectsAABB` と異なり EPS のマージンを挟むため、
|
|
4
|
+
* 境界がちょうど接するだけ(重なり幅 ≤ EPS)のケースは「重ならない」と判定する。
|
|
5
|
+
* これにより ring 探索で接触位置を空きとして採用でき、無限に外へ逃げるのを防ぐ。
|
|
6
|
+
*/
|
|
7
|
+
function intersects(a, b) {
|
|
8
|
+
return (a.x < b.x + b.width - EPS &&
|
|
9
|
+
a.x + a.width > b.x + EPS &&
|
|
10
|
+
a.y < b.y + b.height - EPS &&
|
|
11
|
+
a.y + a.height > b.y + EPS);
|
|
12
|
+
}
|
|
13
|
+
/** box がいずれかの occupied と重なるか。 */
|
|
14
|
+
export function overlapsAny(box, occupied) {
|
|
15
|
+
for (const o of occupied)
|
|
16
|
+
if (intersects(box, o))
|
|
17
|
+
return true;
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function moveTo(box, x, y) {
|
|
21
|
+
return { x, y, width: box.width, height: box.height };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `desired` 中心からの同心リングを外側へ広げ、衝突しない最近傍の位置を返す。
|
|
25
|
+
* 各半径でサンプリングした候補のうち desired 中心に最も近いものを採用。
|
|
26
|
+
*/
|
|
27
|
+
function findByRing(opts) {
|
|
28
|
+
const { desired, occupied, step, maxDistance } = opts;
|
|
29
|
+
if (!overlapsAny(desired, occupied))
|
|
30
|
+
return desired;
|
|
31
|
+
const cx = desired.x + desired.width / 2;
|
|
32
|
+
const cy = desired.y + desired.height / 2;
|
|
33
|
+
for (let r = step; r <= maxDistance; r += step) {
|
|
34
|
+
// 半径が大きいほど角度サンプルを増やす(密度を一定に保つ)。
|
|
35
|
+
const samples = Math.max(8, Math.round((2 * Math.PI * r) / step));
|
|
36
|
+
let best = null;
|
|
37
|
+
let bestDist = Number.POSITIVE_INFINITY;
|
|
38
|
+
for (let i = 0; i < samples; i++) {
|
|
39
|
+
const theta = (i / samples) * Math.PI * 2;
|
|
40
|
+
const ncx = cx + Math.cos(theta) * r;
|
|
41
|
+
const ncy = cy + Math.sin(theta) * r;
|
|
42
|
+
const candidate = moveTo(desired, ncx - desired.width / 2, ncy - desired.height / 2);
|
|
43
|
+
if (overlapsAny(candidate, occupied))
|
|
44
|
+
continue;
|
|
45
|
+
const dist = (ncx - cx) ** 2 + (ncy - cy) ** 2;
|
|
46
|
+
if (dist < bestDist) {
|
|
47
|
+
bestDist = dist;
|
|
48
|
+
best = candidate;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (best)
|
|
52
|
+
return best;
|
|
53
|
+
}
|
|
54
|
+
// 見つからなければ best-effort で desired を返す。
|
|
55
|
+
return desired;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `desired` を起点に、重なる occupied から最小重なり軸方向へ押し出して分離する。
|
|
59
|
+
* 連鎖的な重なりに備えて反復し、上限で打ち切り(best-effort)。
|
|
60
|
+
*/
|
|
61
|
+
function findByPush(opts) {
|
|
62
|
+
const { occupied, maxIterations } = opts;
|
|
63
|
+
let box = opts.desired;
|
|
64
|
+
for (let iter = 0; iter < maxIterations; iter++) {
|
|
65
|
+
// 最も重なっている occupied を選ぶ。
|
|
66
|
+
let target = null;
|
|
67
|
+
let maxOverlapArea = 0;
|
|
68
|
+
for (const o of occupied) {
|
|
69
|
+
if (!intersects(box, o))
|
|
70
|
+
continue;
|
|
71
|
+
const ox = Math.min(box.x + box.width, o.x + o.width) - Math.max(box.x, o.x);
|
|
72
|
+
const oy = Math.min(box.y + box.height, o.y + o.height) - Math.max(box.y, o.y);
|
|
73
|
+
const area = ox * oy;
|
|
74
|
+
if (area > maxOverlapArea) {
|
|
75
|
+
maxOverlapArea = area;
|
|
76
|
+
target = o;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!target)
|
|
80
|
+
return box; // 重なり無し
|
|
81
|
+
// 最小重なり軸へ分離(接触まで)。
|
|
82
|
+
const overlapX = Math.min(box.x + box.width, target.x + target.width) - Math.max(box.x, target.x);
|
|
83
|
+
const overlapY = Math.min(box.y + box.height, target.y + target.height) - Math.max(box.y, target.y);
|
|
84
|
+
const boxCx = box.x + box.width / 2;
|
|
85
|
+
const boxCy = box.y + box.height / 2;
|
|
86
|
+
const tCx = target.x + target.width / 2;
|
|
87
|
+
const tCy = target.y + target.height / 2;
|
|
88
|
+
if (overlapX < overlapY) {
|
|
89
|
+
const dir = boxCx >= tCx ? 1 : -1;
|
|
90
|
+
box = moveTo(box, box.x + dir * (overlapX + EPS), box.y);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const dir = boxCy >= tCy ? 1 : -1;
|
|
94
|
+
box = moveTo(box, box.x, box.y + dir * (overlapY + EPS));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return box;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* `desired` に最も近い、occupied と重ならない位置(同サイズ)を返す。
|
|
101
|
+
* `desired` がそのまま空いていればそのまま返す。
|
|
102
|
+
*/
|
|
103
|
+
export function findFreePosition(opts) {
|
|
104
|
+
const strategy = opts.strategy ?? "ring";
|
|
105
|
+
if (opts.occupied.length === 0 || !overlapsAny(opts.desired, opts.occupied)) {
|
|
106
|
+
return opts.desired;
|
|
107
|
+
}
|
|
108
|
+
if (strategy === "push") {
|
|
109
|
+
return findByPush({
|
|
110
|
+
desired: opts.desired,
|
|
111
|
+
occupied: opts.occupied,
|
|
112
|
+
strategy,
|
|
113
|
+
maxIterations: opts.maxIterations ?? 50,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return findByRing({
|
|
117
|
+
desired: opts.desired,
|
|
118
|
+
occupied: opts.occupied,
|
|
119
|
+
strategy,
|
|
120
|
+
step: opts.step ?? 20,
|
|
121
|
+
maxDistance: opts.maxDistance ?? 2000,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=free-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free-position.js","sourceRoot":"","sources":["../src/free-position.ts"],"names":[],"mappings":"AAmBA,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;;GAIG;AACH,SAAS,UAAU,CAAC,CAAc,EAAE,CAAc;IACjD,OAAO,CACN,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG;QACzB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG;QACzB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG;QAC1B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,G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,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ;YACR,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE;SACvC,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ;QACR,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI;KACrC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getBounds } from "./bounds.js";
|
|
2
|
+
export { type FindFreePositionOptions, type FreePositionStrategy, findFreePosition, overlapsAny, } from "./free-position.js";
|
|
2
3
|
export { aabbHitTest, ellipseHitTest, lineHitTest, pointInPolygon } from "./hit-test.js";
|
|
3
4
|
export { createResize } from "./resize.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getBounds } from "./bounds.js";
|
|
2
|
+
export { findFreePosition, overlapsAny, } from "./free-position.js";
|
|
2
3
|
export { aabbHitTest, ellipseHitTest, lineHitTest, pointInPolygon } from "./hit-test.js";
|
|
3
4
|
export { createResize } from "./resize.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAGN,gBAAgB,EAChB,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edv4h/usketch-shape-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@edv4h/usketch-shared": "4.
|
|
15
|
+
"@edv4h/usketch-shared": "4.3.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"typescript": "5.9.3",
|
|
19
|
-
"vitest": "3.2.
|
|
19
|
+
"vitest": "3.2.7"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|