格子地图生成导航网格

Posted Hichy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了格子地图生成导航网格相关的知识,希望对你有一定的参考价值。


1 Use Marching Squares algorithm to convert obstacle tiles into outlines. Note that map edges is an outline too and need to be included as well.
2 Reduce number of points in outlines using Douglas-Peucker algorithm (purple lines on the bottom picture)
3 Feed all points into Delaunay triangulation (to get most uniform triangles)
4 Add additional points in empty areas and along the map edges (to get more even navmesh)
5 Check along obstacle outlines and flip polygons produced by Delaunay to match outlines. - Often Delaunay could place triangles (grey) mismatching your outlines (red), then you need to detect and flip them. Adjoining them back into a polygon, split it along outline(s) and triangulate it manually enter image description here
    enter image description here
6 Clip obstacles innards - remove polygons that are within obstacles (pink on the picture above)
    tilemap navmesh
7 Fill in connectivity data between remaining triangles and vertices as you need - that\'s your navmesh.

以上是关于格子地图生成导航网格的主要内容,如果未能解决你的问题,请参考以下文章

Unity 实战篇 | 一键生成 x *y 的方阵,并按照地图配置自动改变方阵中某个格子的属性

网格/格子/椭圆区域的矩阵

leetcode 3

css grid 格子布局

岛屿问题--DFS问题

LeetCode 463. 岛屿的周长