Delaunay triangulating the 2d polygon with holes

前端 未结 2 1850
逝去的感伤
逝去的感伤 2021-02-13 06:18

I want to triangulate the complex (but not self-intersecting) polygon with holes, so that resulting triangles all lay inside the polygon, cover that polygon completely, and obey

相关标签:
2条回答
  • 2021-02-13 06:23

    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.

    0 讨论(0)
  • 2021-02-13 06:32

    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):

    enter image description here

    0 讨论(0)
提交回复
热议问题