UNPKG

path-finding-2d

Version:
65 lines 1.83 kB
import { Point, PolygonMap } from 'poly-math-2d'; /** * Fast 2D navigation mesh for pathfinding in triangulated polygons */ export declare class NavMesh2d { private polygonMap; private triangles; constructor(polygonMap: PolygonMap); /** * Build navigation mesh from polygon map */ private buildNavMesh; /** * Get triangle center point (already calculated in TPolygon) */ private getTriangleCenter; /** * Check if point is inside any triangle using barycentric coordinates (fastest method) */ private isPointInTriangle; /** * Find triangle containing the point */ private findTriangleContainingPoint; /** * Check if point is inside navigation mesh */ isPointInNavMesh(point: Point): boolean; /** * Find path from point A to point B using A* algorithm on triangle centers */ findPath(a: Point, b: Point): Point[]; /** * Find closest point to target within polygon bounds */ private findClosestPointInPolygon; /** * A* pathfinding between triangles */ private findTrianglePath; /** * Optimizes the path using the Funnel Algorithm. * This implementation is a robust and correct version of String Pulling. */ private funnel; private getPortalEdges; private getSharedEdge; /** * Removes collinear points from a path. */ private simplifyPath; private getTriangleEdges; private isSameEdge; private segmentsIntersect; private orientation; /** * Calculate twice the signed area of triangle formed by three points */ private triArea2; /** * Check if two points are equal (with small epsilon for floating point comparison) */ private pointsEqual; } //# sourceMappingURL=NavMesh2d.d.ts.map