Bowyer-Watson algorithm: how to fill “holes” left by removing triangles with super triangle vertices

前端 未结 2 1121
我寻月下人不归
我寻月下人不归 2020-12-16 23:05

I am implementing the Bowyer-Watson algorithm as presented at Wikipedia. In my implementation, everything works as I would expect up until the last part of the pseudocode:<

相关标签:
2条回答
  • 2020-12-16 23:18

    It seems you have a solution for your problem but it's also possible to check if the circumcenter of the triangle is outside the supertriangle. You can use a point-in-polygon test. Maybe it can guarantee that there are not missing triangles.

    0 讨论(0)
  • 2020-12-16 23:38

    I encountered the same problem when i was implementing Bowyer-Watson algorithm described here: http://paulbourke.net/papers/triangulate/. I couldn't find anything helpful on internet and even asked at my university, but with no result. After a while I came up with a solution. I started with discovery that for the problem to disappear, the vertices of bounding triangle should ideally lie at infinity, which is not practical. So what does triangles circumcircle look like if triangle has one or two vertices at infinity? It is just line going through the other points. So testing if point lies in triangles circumcircle changes to testing if point lies left or right of line.

    Algorithm then looks like this:

    1. Check if any of triangles vertices lies at infinity. In other words: check if triangle is sharing some vertices with bounding triangle.

    2. If it's sharing all three vertices: trivial.

    3. If it's sharing zero vertices: classical approach - check if distance from point to circumcenter is shorter than circumradius.

    4. If it's sharing one vertex: check if point lies to the left/right of line defined by the other two vertices. one vertex in infinity

    5. If it's sharing two vertices: check if point lies to the left/right of line defined by these two vertices but shifted to the third point. In other words: you take only the slope vector from line between these shared vertices and shift it so that the line passes through the third point. two vertices in infinity

    Testing whether point lies to the left or right of line depends on your triangles winding order.

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