@esengine/pathfinding 13.2.0 → 13.3.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/{KDTree-2rs2EXvm.d.ts → CollisionResolver-CSgWsegP.d.ts} +122 -86
- package/dist/FlowController-BztOzQsW.d.ts +2781 -0
- package/dist/KDTree-BRpn7O8K.d.ts +216 -0
- package/dist/avoidance.d.ts +26 -4
- package/dist/avoidance.js +10 -2
- package/dist/{chunk-JTZP55BJ.js → chunk-3VEX32JO.js} +385 -9
- package/dist/chunk-3VEX32JO.js.map +1 -0
- package/dist/chunk-H5EFZBBT.js +1 -0
- package/dist/chunk-ZYGBA7VK.js +3831 -0
- package/dist/chunk-ZYGBA7VK.js.map +1 -0
- package/dist/ecs.d.ts +440 -647
- package/dist/ecs.js +1020 -1399
- package/dist/ecs.js.map +1 -1
- package/dist/index.d.ts +158 -711
- package/dist/index.js +1353 -1739
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/IIncrementalPathfinding-3qs7e_pO.d.ts +0 -450
- package/dist/LinearProgram-DyD3pI6v.d.ts +0 -56
- package/dist/chunk-JTZP55BJ.js.map +0 -1
- package/dist/chunk-KEYTX37K.js +0 -1
- package/dist/chunk-VNC2YAAL.js +0 -1650
- package/dist/chunk-VNC2YAAL.js.map +0 -1
- /package/dist/{chunk-KEYTX37K.js.map → chunk-H5EFZBBT.js.map} +0 -0
|
@@ -182,6 +182,16 @@ interface IORCASolverConfig {
|
|
|
182
182
|
* @en Numerical precision threshold
|
|
183
183
|
*/
|
|
184
184
|
epsilon?: number;
|
|
185
|
+
/**
|
|
186
|
+
* @zh 是否使用 Y 轴向下的坐标系(如 Canvas/屏幕坐标)
|
|
187
|
+
* @en Whether using Y-axis down coordinate system (like Canvas/screen coords)
|
|
188
|
+
*
|
|
189
|
+
* @zh 这会影响障碍物顶点顺序的判断(CCW 检测)
|
|
190
|
+
* @en This affects obstacle vertex order detection (CCW check)
|
|
191
|
+
*
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
yAxisDown?: boolean;
|
|
185
195
|
}
|
|
186
196
|
/**
|
|
187
197
|
* @zh ORCA 求解结果
|
|
@@ -194,8 +204,8 @@ interface IORCAResult {
|
|
|
194
204
|
*/
|
|
195
205
|
velocity: IVector2;
|
|
196
206
|
/**
|
|
197
|
-
* @zh
|
|
198
|
-
* @en Whether a feasible solution was found
|
|
207
|
+
* @zh 是否找到可行解(满足所有约束)
|
|
208
|
+
* @en Whether a feasible solution was found (satisfies all constraints)
|
|
199
209
|
*/
|
|
200
210
|
feasible: boolean;
|
|
201
211
|
/**
|
|
@@ -203,6 +213,11 @@ interface IORCAResult {
|
|
|
203
213
|
* @en Number of ORCA lines generated
|
|
204
214
|
*/
|
|
205
215
|
numLines: number;
|
|
216
|
+
/**
|
|
217
|
+
* @zh 违反的约束数量
|
|
218
|
+
* @en Number of violated constraints
|
|
219
|
+
*/
|
|
220
|
+
violatedConstraints: number;
|
|
206
221
|
}
|
|
207
222
|
/**
|
|
208
223
|
* @zh ORCA 求解器接口
|
|
@@ -285,123 +300,144 @@ declare const DEFAULT_AGENT_PARAMS: {
|
|
|
285
300
|
};
|
|
286
301
|
|
|
287
302
|
/**
|
|
288
|
-
* @zh
|
|
289
|
-
* @en
|
|
303
|
+
* @zh 碰撞解决器
|
|
304
|
+
* @en Collision Resolver
|
|
290
305
|
*
|
|
291
|
-
* @zh
|
|
292
|
-
* @en
|
|
306
|
+
* @zh 提供位置级别的硬碰撞检测和解决,作为 ORCA 的补充保护层
|
|
307
|
+
* @en Provides position-level hard collision detection and resolution as a supplementary protection layer for ORCA
|
|
293
308
|
*/
|
|
294
309
|
|
|
295
310
|
/**
|
|
296
|
-
* @zh
|
|
297
|
-
* @en
|
|
298
|
-
*
|
|
299
|
-
* @zh 实现最优互惠碰撞避免算法,计算代理的安全速度
|
|
300
|
-
* @en Implements Optimal Reciprocal Collision Avoidance algorithm to compute safe velocities for agents
|
|
311
|
+
* @zh 碰撞检测结果
|
|
312
|
+
* @en Collision detection result
|
|
301
313
|
*/
|
|
302
|
-
|
|
303
|
-
private readonly config;
|
|
304
|
-
constructor(config?: IORCASolverConfig);
|
|
314
|
+
interface ICollisionResult {
|
|
305
315
|
/**
|
|
306
|
-
* @zh
|
|
307
|
-
* @en
|
|
308
|
-
*
|
|
309
|
-
* @param agent - @zh 当前代理 @en Current agent
|
|
310
|
-
* @param neighbors - @zh 邻近代理列表 @en List of neighboring agents
|
|
311
|
-
* @param obstacles - @zh 障碍物列表 @en List of obstacles
|
|
312
|
-
* @param deltaTime - @zh 时间步长 @en Time step
|
|
313
|
-
* @returns @zh 计算得到的新速度 @en Computed new velocity
|
|
316
|
+
* @zh 是否发生碰撞
|
|
317
|
+
* @en Whether collision occurred
|
|
314
318
|
*/
|
|
315
|
-
|
|
319
|
+
collided: boolean;
|
|
316
320
|
/**
|
|
317
|
-
* @zh
|
|
318
|
-
* @en
|
|
321
|
+
* @zh 穿透深度
|
|
322
|
+
* @en Penetration depth
|
|
319
323
|
*/
|
|
320
|
-
|
|
324
|
+
penetration: number;
|
|
321
325
|
/**
|
|
322
|
-
* @zh
|
|
323
|
-
* @en
|
|
326
|
+
* @zh 碰撞法线(从障碍物指向代理)
|
|
327
|
+
* @en Collision normal (pointing from obstacle to agent)
|
|
324
328
|
*/
|
|
325
|
-
|
|
329
|
+
normal: IVector2;
|
|
330
|
+
/**
|
|
331
|
+
* @zh 最近点
|
|
332
|
+
* @en Closest point on obstacle
|
|
333
|
+
*/
|
|
334
|
+
closestPoint: IVector2;
|
|
326
335
|
}
|
|
327
336
|
/**
|
|
328
|
-
* @zh
|
|
329
|
-
* @en
|
|
330
|
-
*
|
|
331
|
-
* @param config - @zh 可选配置参数 @en Optional configuration parameters
|
|
332
|
-
* @returns @zh ORCA 求解器实例 @en ORCA solver instance
|
|
333
|
-
*/
|
|
334
|
-
declare function createORCASolver(config?: IORCASolverConfig): ORCASolver;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* @zh KD-Tree 空间索引
|
|
338
|
-
* @en KD-Tree Spatial Index
|
|
339
|
-
*
|
|
340
|
-
* @zh 用于快速查询指定范围内的邻近代理
|
|
341
|
-
* @en Used for fast neighbor queries within specified range
|
|
337
|
+
* @zh 空碰撞结果
|
|
338
|
+
* @en Empty collision result
|
|
342
339
|
*/
|
|
343
|
-
|
|
340
|
+
declare const EMPTY_COLLISION: ICollisionResult;
|
|
344
341
|
/**
|
|
345
|
-
* @zh
|
|
346
|
-
* @en
|
|
347
|
-
*
|
|
348
|
-
* @zh 每帧重建,支持高效的范围查询
|
|
349
|
-
* @en Rebuilt every frame, supports efficient range queries
|
|
342
|
+
* @zh 碰撞解决器配置
|
|
343
|
+
* @en Collision resolver configuration
|
|
350
344
|
*/
|
|
351
|
-
|
|
352
|
-
private agents;
|
|
353
|
-
private agentIndices;
|
|
354
|
-
private nodes;
|
|
345
|
+
interface ICollisionResolverConfig {
|
|
355
346
|
/**
|
|
356
|
-
* @zh
|
|
357
|
-
* @en
|
|
347
|
+
* @zh 碰撞响应系数(0-1,1 表示完全推出)
|
|
348
|
+
* @en Collision response factor (0-1, 1 means fully push out)
|
|
358
349
|
*/
|
|
359
|
-
|
|
350
|
+
responseFactor?: number;
|
|
360
351
|
/**
|
|
361
|
-
* @zh
|
|
362
|
-
* @en
|
|
352
|
+
* @zh 安全边距(额外距离)
|
|
353
|
+
* @en Safety margin (extra distance)
|
|
363
354
|
*/
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
355
|
+
safetyMargin?: number;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* @zh 默认配置
|
|
359
|
+
* @en Default configuration
|
|
360
|
+
*/
|
|
361
|
+
declare const DEFAULT_COLLISION_CONFIG: Required<ICollisionResolverConfig>;
|
|
362
|
+
/**
|
|
363
|
+
* @zh 碰撞解决器
|
|
364
|
+
* @en Collision Resolver
|
|
365
|
+
*
|
|
366
|
+
* @zh 提供位置级别的硬碰撞检测和解决
|
|
367
|
+
* @en Provides position-level hard collision detection and resolution
|
|
368
|
+
*/
|
|
369
|
+
declare class CollisionResolver {
|
|
370
|
+
private readonly config;
|
|
371
|
+
constructor(config?: ICollisionResolverConfig);
|
|
370
372
|
/**
|
|
371
|
-
* @zh
|
|
372
|
-
* @en
|
|
373
|
+
* @zh 检测圆与单个障碍物的碰撞
|
|
374
|
+
* @en Detect collision between circle and single obstacle
|
|
375
|
+
*
|
|
376
|
+
* @param position - @zh 圆心位置 @en Circle center position
|
|
377
|
+
* @param radius - @zh 圆半径 @en Circle radius
|
|
378
|
+
* @param obstacle - @zh 障碍物 @en Obstacle
|
|
379
|
+
* @returns @zh 碰撞结果 @en Collision result
|
|
373
380
|
*/
|
|
374
|
-
|
|
381
|
+
detectCollision(position: IVector2, radius: number, obstacle: IObstacle): ICollisionResult;
|
|
375
382
|
/**
|
|
376
|
-
* @zh
|
|
377
|
-
* @en
|
|
383
|
+
* @zh 检测圆与所有障碍物的碰撞
|
|
384
|
+
* @en Detect collision between circle and all obstacles
|
|
385
|
+
*
|
|
386
|
+
* @param position - @zh 圆心位置 @en Circle center position
|
|
387
|
+
* @param radius - @zh 圆半径 @en Circle radius
|
|
388
|
+
* @param obstacles - @zh 障碍物列表 @en List of obstacles
|
|
389
|
+
* @returns @zh 最严重的碰撞结果 @en Most severe collision result
|
|
378
390
|
*/
|
|
379
|
-
|
|
391
|
+
detectCollisions(position: IVector2, radius: number, obstacles: readonly IObstacle[]): ICollisionResult;
|
|
380
392
|
/**
|
|
381
|
-
* @zh
|
|
382
|
-
* @en
|
|
393
|
+
* @zh 解决碰撞,返回修正后的位置
|
|
394
|
+
* @en Resolve collision, return corrected position
|
|
395
|
+
*
|
|
396
|
+
* @param position - @zh 当前位置 @en Current position
|
|
397
|
+
* @param radius - @zh 半径 @en Radius
|
|
398
|
+
* @param obstacles - @zh 障碍物列表 @en List of obstacles
|
|
399
|
+
* @returns @zh 修正后的位置 @en Corrected position
|
|
383
400
|
*/
|
|
384
|
-
|
|
401
|
+
resolveCollision(position: IVector2, radius: number, obstacles: readonly IObstacle[]): IVector2;
|
|
385
402
|
/**
|
|
386
|
-
* @zh
|
|
387
|
-
* @en
|
|
403
|
+
* @zh 验证速度是否会导致碰撞,返回安全速度
|
|
404
|
+
* @en Validate velocity won't cause collision, return safe velocity
|
|
405
|
+
*
|
|
406
|
+
* @param position - @zh 当前位置 @en Current position
|
|
407
|
+
* @param velocity - @zh 目标速度 @en Target velocity
|
|
408
|
+
* @param radius - @zh 半径 @en Radius
|
|
409
|
+
* @param obstacles - @zh 障碍物列表 @en List of obstacles
|
|
410
|
+
* @param deltaTime - @zh 时间步长 @en Time step
|
|
411
|
+
* @returns @zh 安全速度 @en Safe velocity
|
|
388
412
|
*/
|
|
389
|
-
|
|
413
|
+
validateVelocity(position: IVector2, velocity: IVector2, radius: number, obstacles: readonly IObstacle[], deltaTime: number): IVector2;
|
|
390
414
|
/**
|
|
391
|
-
* @zh
|
|
392
|
-
* @en
|
|
415
|
+
* @zh 检测两个代理之间的碰撞
|
|
416
|
+
* @en Detect collision between two agents
|
|
417
|
+
*
|
|
418
|
+
* @param posA - @zh 代理 A 位置 @en Agent A position
|
|
419
|
+
* @param radiusA - @zh 代理 A 半径 @en Agent A radius
|
|
420
|
+
* @param posB - @zh 代理 B 位置 @en Agent B position
|
|
421
|
+
* @param radiusB - @zh 代理 B 半径 @en Agent B radius
|
|
422
|
+
* @returns @zh 碰撞结果 @en Collision result
|
|
393
423
|
*/
|
|
394
|
-
|
|
424
|
+
detectAgentCollision(posA: IVector2, radiusA: number, posB: IVector2, radiusB: number): ICollisionResult;
|
|
395
425
|
/**
|
|
396
|
-
* @zh
|
|
397
|
-
* @en
|
|
426
|
+
* @zh 解决代理之间的碰撞
|
|
427
|
+
* @en Resolve collision between agents
|
|
428
|
+
*
|
|
429
|
+
* @param posA - @zh 代理 A 位置 @en Agent A position
|
|
430
|
+
* @param radiusA - @zh 代理 A 半径 @en Agent A radius
|
|
431
|
+
* @param posB - @zh 代理 B 位置 @en Agent B position
|
|
432
|
+
* @param radiusB - @zh 代理 B 半径 @en Agent B radius
|
|
433
|
+
* @returns @zh 修正后的位置 [A, B] @en Corrected positions [A, B]
|
|
398
434
|
*/
|
|
399
|
-
|
|
435
|
+
resolveAgentCollision(posA: IVector2, radiusA: number, posB: IVector2, radiusB: number): [IVector2, IVector2];
|
|
400
436
|
}
|
|
401
437
|
/**
|
|
402
|
-
* @zh
|
|
403
|
-
* @en Create
|
|
438
|
+
* @zh 创建碰撞解决器
|
|
439
|
+
* @en Create collision resolver
|
|
404
440
|
*/
|
|
405
|
-
declare function
|
|
441
|
+
declare function createCollisionResolver(config?: ICollisionResolverConfig): CollisionResolver;
|
|
406
442
|
|
|
407
|
-
export {
|
|
443
|
+
export { CollisionResolver as C, DEFAULT_ORCA_CONFIG as D, EMPTY_COLLISION as E, type IORCALine as I, type IAvoidanceAgent as a, type IObstacle as b, type IORCASolverConfig as c, type IORCAResult as d, type IORCASolver as e, type INeighborResult as f, type ISpatialIndex as g, type ICollisionResult as h, type ICollisionResolverConfig as i, DEFAULT_AGENT_PARAMS as j, DEFAULT_COLLISION_CONFIG as k, createCollisionResolver as l, type IObstacleVertex as m };
|