Delaunay mesh in rhinocommon

Hi
Using Mesh.CreateFromTessellation in rhinocommon I’m able to get a mesh similar to what the delaunay mesh component in Grasshopper produces except for some extra faces along the outer edges. I managed to get rid of most of these faces by checking if the face normals are close to vertical, but this process is slow and does not get rid of all of them. Does anyone know how to get a similar result as the delaunay mesh component in Grasshopper?

import Rhino.Geometry as rg

mesh = rg.Mesh.CreateFromTessellation(points, list(), rg.Plane.WorldXY, False)
normals = mesh.FaceNormals
mask = [normal.EpsilonEquals(rg.Vector3d.ZAxis, 0.99) for normal in normals]
mesh = rg.Mesh.CreateFromFilteredFaceList(mesh, mask)

Hi @Bendiko,

Grasshopper’s Delaunay solver is not use the the RhinoCommon method you’ve referenced. So it is unlikely you’ll ever get the same results.

– Dale

Thank you for the reply Dale. I guess I’ll just have to make do. For my use case I get a good result by modifying my code as below to mask out near vertical faces and faces with a very high aspect ratio. It is however much slower than the Grasshopper component.

import Rhino.Geometry as rg
MAX_ASPECT_RATIO = 200

mesh = rg.Mesh.CreateFromTessellation(points, list(), rg.Plane.WorldXY, False)
normals = mesh.FaceNormals
faces = mesh.Faces
mask = [faces.GetFaceAspectRatio(i) < MAX_ASPECT_RATIO and normal.EpsilonEquals(rg.Vector3d.ZAxis, 0.99) for i, normal in enumerate(normals)]
mesh = rg.Mesh.CreateFromFilteredFaceList(mesh, mask)

Thank you. I had no idea something like this existed. Could be useful in lots of situations.