Content deleted Content added
Mention time complexity of the pollowing pseudocode. It was a point of confusion for readers and even lead to a stackoverflow question. |
Adding short description: "Computation method in geometry" |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1:
{{Short description|Computation method in geometry}}
In [[computational geometry]], the '''Bowyer–Watson algorithm''' is a method for computing the [[Delaunay triangulation]] of a finite set of points in any number of [[dimension]]s. The algorithm can be also used to obtain a [[Voronoi diagram]] of the points, which is the [[dual graph]] of the Delaunay triangulation.
==Description==
The Bowyer–Watson algorithm is an [[Incremental computing|incremental algorithm]]. It works by adding points, one at a time, to a valid Delaunay triangulation of a subset of the desired points. After every insertion, any triangles whose circumcircles contain the new point are deleted, leaving a [[star-shaped polygon]]al hole which is then re-triangulated using the new point. By using the connectivity of the triangulation to efficiently locate triangles to remove, the algorithm can take ''O(N log N)'' operations to triangulate N points, although special degenerate cases exist where this goes up to ''O(N<sup>2</sup>)''.<ref>Rebay, S. ''Efficient Unstructured Mesh Generation by Means of Delaunay Triangulation and Bowyer-Watson Algorithm''. Journal of Computational Physics Volume 106 Issue 1, May 1993, p. 127.</ref>
<gallery>
Line 18 ⟶ 19:
==Pseudocode==
The following [[pseudocode]] describes a basic implementation of the Bowyer-Watson algorithm.
<syntaxhighlight lang="javascript">
if point is inside circumcircle of triangle
add triangle to badTriangles
for each edge in triangle do
if edge is not shared by any other triangles in badTriangles
add edge to polygon
remove triangle from triangulation
newTri := form a triangle from edge to point
add newTri to triangulation
remove triangle from triangulation
</syntaxhighlight>
Line 50 ⟶ 51:
== Further reading ==
*{{Cite journal | last1 = Bowyer | first1 = Adrian |author1-link=Adrian Bowyer| title = Computing Dirichlet tessellations | doi = 10.1093/comjnl/24.2.162 | journal = [[The Computer Journal|Comput. J.]] | volume = 24 | issue = 2 | pages = 162–166 | year = 1981 |
*{{Cite journal | last1 = Watson | first1 = David F.
* [http://paulbourke.net/papers/triangulate/ Efficient Triangulation Algorithm Suitable for Terrain Modelling] generic explanations with source code examples in several languages.
|