# Create a Mesh with Delaunay Mesh Component

Hi,

I am have been playing with the mesh options in GH. After a while I was able to reproduce a nice implementation from another post to create spaced points in the surface.

I want to create a mesh with Delaunay mesh component but my problem is that I cannot find a clean way to create a mesh that extends only up to the edges. When I connect the points to the component I got something like this:

Any advice on how to get rid of of the extra triangles outside of the contour of the surface?

Attached you can find the GH Definition. Thanks in advance

Mesh2.gh (11.5 KB)

Try sorting the edges by length, and cull the edges that are longer than the longest internal edges.

// Rolf

1 Like

I usually do something like this (and assuming your first set of points is from dividing a curve, you wont need the interp curve part, I just had to remake the curve boundary as you only provided the points)

Mesh2Keep.gh (15.8 KB)

5 Likes

Hereâ€™s another approach, culling faces that have acute edge-edge angles (i.e. pointy faces):

210430_CullAcuteFaces_00.gh (17.3 KB)

Thereâ€™s definitely better/more performant implementations, but the logic seems sound in this case.

4 Likes

Thanks @Michael_Pryor and @AndersDeleuran, both solutions work perfectly.

Nice! Reason I do the boundary surf / ray method is sometimes I have a shape with internal holes and the triangles in them are often still pretty regular so the edge way misses them. And also so I donâ€™t have to mess with the slider when shape changes.

Yeah, itâ€™s rare that one doesnâ€™t have the boundary curves (I find). I usually just check for face center curve containment in these cases. Another approach that we didnâ€™t cover is the ball pivot algorithm, I think @Petras_Vestartas recently made an implementation available as well if recall (for meshing large point clouds). Thatâ€™s probably pretty overkill in 2D though, but might be relevant.

2 Likes

I usually just check for face center curve containment in these cases.

Yes only reason I switched to rays is because the meshes Iâ€™m using these days are so dense and the containment takes ages in Gh. The ray is always so fast. In this case, I think it doesnâ€™t matter either way.

1 Like

Mesh2.gh (13.8 KB)

5 Likes

Nice @Dani_Abalde dunno how that slipped by me but you will still need to adjust A depending on the mesh yea? and what about conditions with intended holes (that is my usual situation, although I know not the situation of this specific post).

For some reason it has gone unnoticed by most.

Yes, the length of the edges you expect to catch should be uniform using the component.

I donâ€™t know what you mean by intended holes. If you mean internal holes, the alpha shape algorithm can handle them.

From code you can access a method that instead of receiving a constant alpha radius, receives a function that maps each edge to a value of the radius.

1 Like

Yea that. Here is my usual kind of situation where alphashape and edge length fails because mesh in holes is pretty similar to the ones not in the holes, and the same goes for faces out of the boundary.

[Mesh2Keep.gh|attachment]Mesh2Keep2.gh (25.3 KB)

Here is how the mesh looks pre removal of faces.

This just my situation though that I found rays pretty robust. I am rarely dealing with uniformish faces as the mesh faces or verts are then moved up or down to result in 2.5D texture patterns.

Definitely there are many ways to get the answer and I really appreciate everyone sharing their ways of solving the problem.

Given that we are still talking about meshes does anyone has a robust way to consider single points in the mesh creation? The entire reason why I started looking at mesh creation in GH using Delaunay was because it is robust and easy enough to create triangular meshes given any point you have in the geometry.

For example here I have the same previous example but here I am adding some random lines and points that represent columns. For Structural analysis purposes it is very important to have a point where the columns intersects with the surface be part of the mesh.

Using the workflows previously shown the points can be easily added therefore it is relatively easy to add the column points as part of the mesh.

Where this gets really tricky at least for me is when you want to create a quad mesh instead of a triangular mesh. I was testing the new Quad Remesh and I found that the tool is pretty robust and the mesh is pretty nice and uniform, the only drawback that I found was that I cannot add points to the definition to take them into account to create the mesh.

Does anyone has a workflow to deal with this having quad mesh. I know Karamba has an awesome component that lets you consider points to create meshes but it is only for triangular meshes. Quad Mesh.gh (17.8 KB)

Hereâ€™s one way to take the result from QuadRemesh and some input points and snap the closest vertices, then relax to keep the mesh quality

2 Likes

@DanielPiker, this is beautiful and works really well! Thanks.

1 Like

After noticing SuperDelaunay I tried it out but I cannot get the alpha shape to include a hole in a planar meshâ€¦

Here I am creating a polygon with a scaled polygon at its centre and using the polygons to create points for the SuperDelaunay. I canâ€™t get a hole in the middle thoughâ€¦

What i wantâ€¦

What I really really wantâ€¦

Interestingly (for some) the SuperDelaunay doesnâ€™t work for polygons where vertices lie on the Y axis (which forces me to call into question the â€śSuperâ€ť status of this Delaunay component and suggest VeryGoodDelaunay might be more appropriate?)â€¦

There is probably many other ways to create this basic mesh and Delaunay is probably overkill.

SuperDelaunayTest.gh (9.7 KB)

Well, to me that is not a case for the Alpha Shape algorithm, since it requires manually to adjust the alpha value for each input configuration.

SuperDelaunayTest.gh (16.1 KB)

Please send me the file to reproduce and fix it if needed.

I donâ€™t actually understand alpha valur which is probably half the problem

The file attached in my other post shows a delaunay output only for polygons that donâ€™t have points on the 6 axis.

No idea what do you mean.

So in this fileâ€¦ SuperDelaunayTest.gh (9.7 KB)

â€¦when I change the number of sides of the polygonâ€¦

I get this error for polygons with 4, 8 and 12 sidesâ€¦

â€ś1. Solution exception:Duplicated vertex Vertex [0 | 98.49,0]â€ť

My guess was that it has something to do with having a vertex on the y axis as thatâ€™s one thing that 4, 8 and 12 sided polygons have in common.