TriRemesh with maximum number of neighbors

@DanielPiker is there a way to run TriRemesh or RemeshByColour and limit the number of neighbors of each vertex to 6 ?

Hi Martin,

Not currently. It would be possible to write new conditions for valence targets, but I think having none above 6 would usually not be possible.

The remesher regularises the valence by flipping edges. So it considers the 4 vertices of a pair of adjacent triangles and sees whether flipping their shared edge would improve things. Flipping an edge always increases the valence of 2 vertices by 1 each, and reduces the valence of the other 2 vertices by 1 each.
For example in a fully regular mesh with all valence 6 vertices, flipping any edge produces 2 valence 5 vertices and 2 valence 7 vertices.
In a dense unstructured, non-uniform, but fairly isotropic mesh like we get from Triremesh, we’ll generally have mostly 6s, and nearly equal numbers of 5s and 7s.
The exact balance is actually related to the genus of the mesh. For any shape which is topologically a sphere with all vertices having valence 5,6 or 7, there will always be exactly 12 more 5s than 7s.
Even when you have millions of vertices this difference stays at 12.
(For a topological torus, there will be an equal number of 5s and 7s)

While it is possible to triangulate a sphere with exactly 12 valence 5s and no valence 7s (like a subdivided icosahedron), because the remesher works locally and iteratively it usually won’t find this global optimum.
There was a fun paper back in 2010 about interactively dragging combinations of these irregular vertices about, and pairs of 5s and 7s can be brought together to annihilate each other, but it required user interaction to guide them together over longer distances than happens with the automated local approach.

Thanks for this detailed response. My problem is the size of the polygons in the dual after remeshing.

Valence 7 points result in larger polygons than the hexagons around them. Maybe I need to tri remesh differently?

I’m trying to create a workflow to process dozens of meshes so I prefer not having to manipulate too much manually

Ah, in this case what you probably want are some different settings for calculating the dual rather than actually changing the triangular mesh.
As I mentioned in this post, when making the dual of a triangular mesh, there are a lot of different ways we can choose how to place the dual vertex corresponding to each triangle face, depending on the qualities we want the dual to have (eg similar edge lengths, orthogonality to the primal edges, similar angles, similar areas). The built in one aims for a balance between these, but it would be possible to prioritise area. I’ll try and post an example later.


Thanks Daniel. Below is a Grasshopper file with a part of one of my meshes. (27.8 KB)

Here’s a script with an example of a dual with custom weighting. (14.0 KB)

Here the position of each dual vertex is a weighted average of the 3 points of the corresponding triangle in the primal mesh, and the weighting is the valence of the vertex (raised to a given power).
This has the effect of pulling the dual vertices towards the valence 7 verts and pushing them away from the valence 5s.

I’m thinking out loud in equalize ngons Area with K2 :thinking: with some constraints… just an idea.

The effect is subtle, but notice how on the the right the 7 and 5 sided faces are more similar in size, compared to the dual output by TriRemesh on the left (which has more regular shaped faces).

I’ve tried this approach in the meantime but didn’t get the result I was looking for. The polygons ended up looking like voronoi cells.

Indeed, for similar area faces, we could optimise, either in Kangaroo, or by adding a loop in the script above, where we generate the dual, check its areas, then adjust the weights based on those and repeat.

Thanks for the script. It seems to ignore naked vertices. Otherwise it looks promising.

Yes, I skipped the special treatment used in the triremesh dual for the boundaries(and creases) here for simplicity.