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

Method findPolygonAt

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

* @zh 查找包含点的多边形 * @en Find polygon containing point

(x: number, y: number)

Source from the content-addressed store, hash-verified

263 * @en Find polygon containing point
264 */
265 findPolygonAt(x: number, y: number): INavPolygon | null {
266 for (const polygon of this.polygons.values()) {
267 if (this.isPointInPolygon(x, y, polygon.vertices)) {
268 return polygon;
269 }
270 }
271 return null;
272 }
273
274 /**
275 * @zh 检查点是否在多边形内

Callers 3

getNodeAtMethod · 0.95
isWalkableMethod · 0.95
findPathMethod · 0.95

Calls 2

isPointInPolygonMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected