# Fill Holes in a mesh

I am working with 2 meshes…
And I wanted to combine them seamlessly in variable of their dispropotions…
I combined them But still there are some gaps in between them

Like the one image below

I want to make the gap fill along its edges to make them perfectly combined…

These can be done using softwares like blender .

But my question is there any library to acheive this…
Specifically is there any three.js function or any other library function to achieve this…

I tried them with few python libraries like vtkplotter and trimesh where they have a function called fillholes() .

But in vtkplotter it doesn’t actually fillholes along edge to edge rather it fills with the closest points.
And in trimesh it only fills within one triangle range.

How I need it to be like is…
The mesh can be distored but there shouldn’t be any evident difference between both meshes .
Both should blend together into a single smooth perfect mesh .
Is there any function or library to acheive this

Few examples of the situation is provided in the below images…

And the last example case where a hand and arm is to be combined together…

And Thanks in advance to anyone who took time to read through it…

Maybe it works with the triangulation method - Algorithm based on E. Hartmann - I used?

Addon for triangulation of implicit surfaces/ forms with holes

Triangulation cylinder with holes

Triangulation sphere with holes - #6 by hofk

GitHub - hofk/THREEi.js: three.js addon for triangulation of implicit surfaces and for forms with holes. The addon generates indexed BufferGeometries.

1 Like

But I couldn’t get how it can help me …
I have a loaded .obj mesh with holes in it due to improper combination.
How can threei.js work on it…
Can you help me with the code for it

I have something if you want to close an open region in the geometry. It won’t work for totally separate regions. It won’t also give eye pleasing result if the vertices are not in a plane.

I wrote the code a while ago and have forgotten where I kept it (i moved it from the directory in the screenshot). I will update this post with a fiddle soon.

1 Like

I have no experience with modeling software, but when I see the very different examples it seems to make sense to do this with such software.

For the algorithm I use one needs a mathematical description of the area to be filled. Either implicitly or explicitly as with the sphere and the cylinder. For this purpose the boundary points must also lie on this surface.

So first of all you need an algorithm which generates such a surface function from the boundary points. This is similar (only much more complicated) to generating a Bézier curve. https://en.wikipedia.org/wiki/Bézier_curve

I don’t have a source on that right now.

Only with the help of this function would the triangulation algorithm according to E. Hartmann work.

Connected spheres, but created completely without modelling software can be found there.
https://hofk.de/main/threejs/sandboxthreei/implicitSurface.html