import { PolyPoints } from "../common-types"; import { TileWalkableTest } from "./grid-map"; /** * This parses a world that is a uniform grid into convex polygons (specifically rectangles) that * can be used for building a navmesh. This is designed mainly for parsing tilemaps into polygons. * The functions takes a 2D array that indicates which tiles are walkable and which aren't. The * function returns PolyPoint[] that can be used to construct a NavMesh. * * Notes: * - This algorithm traverses the walkable tiles in a depth-first search, combining neighbors into * rectangular polygons. This may not produce the best navmesh, but it doesn't require any manual * work! * - This assumes the world is a uniform grid. It should work for any tile size, provided that all * tiles are the same width and height. * * @param map 2D array of any type. * @param tileWidth The width of each tile in the grid. * @param tileHeight The height of each tile in the grid. * @param isWalkable Function that is used to test if a specific location in the map is walkable. * Defaults to assuming "truthy" means walkable. * @param [shrinkAmount=0] Amount to "shrink" the mesh away from the tiles. This adds more polygons * to the generated mesh, but can be helpful for preventing agents from getting caught on edges. * This supports values between 0 and tileWidth/tileHeight (whichever dimension is smaller). */ export default function buildPolysFromGridMap(map: TileType[][], tileWidth?: number, tileHeight?: number, isWalkable?: TileWalkableTest, shrinkAmount?: number): PolyPoints[]; //# sourceMappingURL=build-polys-from-grid-map.d.ts.map