Mesh Fill Holes - Best strategy?

I need to find a reliable way to fill small holes in a mesh. Example of what I have is to the left in the picture, and when I run mesh.FillHoles() it… well, it doesn’t look very good (right):

The outer edges can be left as is (probably can’t be fixed(?))

Best strategy? Preferably via RhinoCommon, but any solution that works well for this is welcome

// Rolf

I found a “Patch” component in the Yellow plugin which can do the job. But, can anyone hint about how to do it with RhinoCommon?

// Rolf

There is a Mesh Patch method. However looking at the Mesh.FillHoles() method you will see this:


Which leads you to a very similarly named method called Mesh.FillHole which seems to be able to make the fills by setting a start index of the edge chain.

2 Likes

Aha, OK. But how do I differ between an “outer” edge loop and inner edge loops? (I have not yet started to dive very deep into traversing meshes, but it seems the time has come…)

// Rolf

2 Likes

That I am not exactly sure, I imagine there are a few different ways for different cases (the way you did is what I would do in your specific case).

1 Like

This approach might also work here:

1 Like

There’s various ways to do that but in cases like the mesh captured use (add the obvious checks etc etc):

Screen%20Shot%20005

BTW: Do you know all things related with mesh V, E, F connectivity? Can you map vertices indices to topology vertices indices? (and the other thing). Do you have any decent Ball Pivot C#? (or Delauney for some cases).

1 Like

OK, I can get the inner loops. But since they are Polylines with segments with lost relation to the Edge indices, I need to do some drilling to get hold of the edge indices, somehow.

It seems indices is always needed - to get hold of any of the other indices! Hm.

I bet there must be a way to get the edge index, but in the documentation I have so far only arrived at; -“you need an index for the index you are looking for”, kind of.

All things related? Hm, that would be an exaggeration. I have read up on the half-edge concept, but I have not drilled into Rhino Mesh. Without a class diagram for all the TopologyLists if feel kind of lost. I always arrive at yet another index which I need in order to get the index I’m searching for. Aso.

Nope. I have no idea about that concept. Is the concept documented somewhere?

// Rolf

OK I’ll prepare a small demo on that matter (using a similar mesh with the thing of yours as captured).

BUT … you must answer the Mother Of All Questions first: If you had the choice which Ducati would you buy?

  • 916 SPS Foggy Replica
  • 999 R
  • 1098
  • 1299 S
  • V4S

PS: What about the ultimate? NCR Ducatis (only for the absurdly rich)

Googling… :wink:

I see that you are a man lost in space (I mean this question IS elementary my Dear Watson).

Until the right answer … here’s some things:

If you have holes (well … stuff that can classify as “holes” [but what is a hole? ]) using the R thingy is out of question (Kinda riding any Honda => no no) :


The right thing to do is (a) find all inner holes/topo vertices/blah blah and then (b) do a Delauney (requires cleaning/fitting) or a Ball Pivot (requires measuring edges in order to provide the correct search R) . Of course for planar (or almost planar) meshes - where D works OK - this is easy (Mesh Machine plays ball as well in such cases) … but the more the mesh is like a blob (or a very hilly terrain) and the holes are non planar … things become quite complicated. That said all my BP things are strictly internal.

You guys are seriously over complicating things here, the method (i.e. get naked edge loops and triangulate these) I linked to above will likely work. Although there might be situations such as these that require one to further break down the polylines forming the edge loops to ensure valid meshing (in this case, these three holes might be returned as one polyline which will have overlapping vertices):

2018-09-27%2012_00_14-Mesh%20Fill%20Holes%20-%20Best%20strategy_%20-%20Grasshopper%20Developer%20-%20McNeel%20Forum

As for distinguishing between outer/inner loops, I think I’d simply set a MaxLoopSize input parameter, and then only triangulate/mesh edge loops of a certain size. That way you’d negate the whole surface topology concern entirely.

Indeed it works for some cases. But the general case (“big” holes + some way to fill the holes [or some way to make a mesh soild] with “as - on average - same looking as possible” faces) is not that easy.

Anyway for Rolf that one (freaky MTV, MV connectivity matters etc etc) :

Mesh_MTV_VS_MV_VS_Loops_V1.gh (124.2 KB)
Mesh_MTV_VS_MV_VS_Loops_V1.3dm (283.5 KB)

Hole size shouldn’t matter:

180927_FillMeshHoles_00.gh (77.9 KB)

But of course the topology of the hole does (as per my last post above) and ones requirements for the triangulation of it (i.e. should one insert new vertices within the hole etc.).

Edit: The by far best and most reliable/simple motorised vehicle I’ve ever owned:

FZ50

2 Likes

the only other thing that might be worth mentioning, in regards to meshes, is to add one more line to that for cleanup. I’ve noticed that in V6, (maybe it’s just me), that meshes are a little less forgiving than V5. Not that it’s a bad thing at all, just an observation.
FillMesh.Compact()
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Mesh_Compact.htm

Sweet Jesus: that thing not only is a scooter but is a Suzuki as well. Plus is painted in Suzuki racing colors (hope dies last: last time that S won the top class was 2.5+M years ago). But I do admit that the greatest racer ever was a Suzuki rider (2.5+ M years ago).

Moral: Ducatium Amamus Dum Spiramus.

Other than this very serious matter … that poly.TriangulateClosedPolyline(); Method does meshes that are even uglier than the Suzuki (any Suzuki to be honest). This rises the 1GZ question: where is this world heading? (with regard Suzuki matters, forget meshes).

Mesh_MTV_VS_MV_VS_Loops_V1A.gh (131.9 KB)

It’s a moped.

Yes, as it does not:

Which may or may not be a requirement.

Okay, you guys are awsome. I will start out as a moped and try to evolve into a Ducati over time. But not until after the weekend.

Anyway, thank you all for your contributions, all hints are useful, in one way or another.

I also just noticed that I had not uploaded the actual mesh, which may have some self intersecting edges.

GlenoidSrf_PatchHoles.gh (85.9 KB)

Now off to attend my son’s disputation for PhD.

Shameless plug: For anyone interested in high capacity computing (HPC) and my son’s contributions to the field by, among other things, making Spotify’s workflow system Luigi fit for research in bioinformatics (simplified use) as well as his own creation, the fast & close to the metal slim alternative platform for workflow processing “SciPipe”, have a look at the following links. One of Pachyderm’s developers (Whitenack) compares three current top workflow systems for HPC & streaming data where he lists Pachyderm, my son’s version of Luigi (SciLuigi) and his "close to the metal SciPipe as the most noteworthy.
Main objectives; Simplication (ease of use, restore verifiability and repreducibility, stability, restartability after failed week-long runs, etc) and speed, by going closer to the metal.

For researchers in the field of bioinformatics and anyone with ned for HPC;

Problems for which all the above serves as part solutions: Recent research on the increasing technical complexity in bioinformatics ruining the classic approach of independent verification & reproducibility of earlier research.

All open source, of course.

And yes, Grasshopper actually is a kind of such a workflow system, and also the CAD world would benefit from actually addressing the problems with scalability, complexity and speed.

// Rolf

1 Like

Advise the son to quit Academic thinking (ASAP) and start walking the walk (ASAP) : the Red Panigale V4S one .

BTW: If (in some cases) the Mesh Machine way is used you’ll need to repair the mesh (in some places). Procedure/Strategy is rather clear (I do hope):

BTW: Try Mesh Lab as well:

BTW: For sale: R1200S (pig ugly and faulty), Blade '17 (perfect and boring) RC8R (stunning and naive). Call day/night with cash on hand.

BTW: I’m sure that you know these (or some similar) as well:

A-robust-hole-filling-algorithm-for-triangular-mesh.pdf (660.6 KB)
Modified half-edge data structure and its applications to 3D mesh.pdf (1.4 MB)