Delaunay Triangulation with Rhino Python

by Tuğrul Yazar | July 27, 2017 09:51

Boris Nikolayevich Delaunay was a Russian mathematician and mountain climber. He developed the Delaunay triangulation, which is a method in computational geometry. It is a triangulation of a set of points such that no point is inside the circumcircle of any triangle formed by the points. It’s widely used in computer graphics and mesh generation. In 2013, I made the brute force code in Rhino Python[1] which is a slow solution to this problem. It used to be a nice computational geometry exercise before it became widely available and popular. Still, I frequently revisit and update this cute code. The latest version handles an animated construction while keeping the test circles. I made it even slower to clearly show the process. Also, there are some tips about drawing order in Rhino Python.

delaunay triangulation

This Rhino Python code calculates the Delaunay Triangulation of any given point set in 2D. The input of the tool is the set of points. Just run the EditPythonScript command and Open the py file. Since this tool is for educational purposes, I advise you to keep the number of points at a minimum (10-15 for example). The outputs are a series of closed polylines. The code uses native Rhino Python libraries. Thus, no add-ons are necessary for it to work.

delaunay triangulation

You can rewrite this code by looking at the text seen in the animations. You must run it inside the Rhino Python editor. However, if you want to support my website by downloading my working files; would you consider being my Patreon? Here is the link[2] to my Patreon page including the Python file for the Delaunay Triangulation and many more. Thank you.

delaunay triangulation
Endnotes:
  1. Rhino Python: https://www.designcoding.net/category/tools-and-languages/rhino-python/
  2. Here is the link: https://www.patreon.com/posts/delaunay-with-99777872?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link

Source URL: https://www.designcoding.net/delaunay-triangulation-with-rhino-python/