码迷,mamicode.com
首页 > 其他好文 > 详细

格子地图生成导航网格

时间:2018-02-07 12:07:40      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:ram   网格   manual   分享图片   could   get   post   log   with   


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
    技术分享图片
6 Clip obstacles innards - remove polygons that are within obstacles (pink on the picture above)
    技术分享图片
7 Fill in connectivity data between remaining triangles and vertices as you need - that‘s your navmesh.

格子地图生成导航网格

标签:ram   网格   manual   分享图片   could   get   post   log   with   

原文地址:https://www.cnblogs.com/Hichy/p/8425554.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!