MCPcopy Create free account
hub / github.com/esengine/esengine / calculatePathLength

Method calculatePathLength

packages/pathfinding/src/navmesh/NavMesh.ts:568–576  ·  view source on GitHub ↗

* @zh 计算路径总长度 * @en Calculate total path length

(path: readonly IPoint[])

Source from the content-addressed store, hash-verified

566 * @en Calculate total path length
567 */
568 private calculatePathLength(path: readonly IPoint[]): number {
569 let length = 0;
570
571 for (let i = 1; i < path.length; i++) {
572 length += euclideanDistance(path[i - 1], path[i]);
573 }
574
575 return length;
576 }
577
578 /**
579 * @zh 清空导航网格

Callers 1

findPathMethod · 0.95

Calls 1

euclideanDistanceFunction · 0.90

Tested by

no test coverage detected