Delaunay Triangulation with Rhino Python
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 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.
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.
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 to my Patreon page including the Python file for the Delaunay Triangulation and many more. Thank you.