Delaunay triangulating the 2d polygon with holes

痴心易碎 提交于 2019-12-03 11:41:49

It sounds like you want constrained Delaunay triangulation. The "holes" can be implemented by constraining input edges to remain unbroken in the triangulation.

See the Triangle and poly2tri projects for implementations.

Here's one of the methods I came up with when doing navmesh for an RTS game. Note that it is homebrew, no third-party tools were used, it took me about 3 weeks to implement and bugfix:

  1. Feed all points into Delaunay triangulation (to get most uniform triangles)
  2. Check along holes outlines and flip polygon pairs produced by Delaunay to match outlines
  3. Clip holes innards

Result (plz ignore purple outlines):

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!