martedì, aprile 05, 2016

Delaunay Triangulation with Dynamo

I was reading a twit by Dimitar Venkov and it caught my attention, how can you use Dynamo to create a triangular mesh from a list of points, here is the discussion on the forum.

I was looking at the same problem my self not too long ago, it is achievable in Dynamo too but there is a lot to learn about Delaunay Triangulation and the algorithms to solve it.

Searching on the internet I've found several examples, the one I decided to try to implement in Dynamo is this one.

Basically is what Revit does when it reads a LandXML file and converts it into a Topographic Surface, well... almost..., therefore some "ghost" triangles outside the true mesh are going to appear.
If it is possible to add an outline, like a polycurve, they could be removed with a little bit extra effort.
This is not yet a Constrained Delaunay Triangulation though, but it works.

To be honest I had to swap the Y and Z coordinates in this example ant then swap it back before creating the surfaces and get rid of an extra "construction" triangle in the latest while loop.

Using the same algorithm it is possible to derive the IndexGroups  and create a Dynamo Mesh from the same list of points, the graphical result is quite different and smooth.

Once again our Dynamo Swiss Knife saved the day.

Nessun commento:

Posta un commento