How to close gaps on mesh (or: move verts to average position by radius)

Hey folks,

I am trying to find a proper way to close gap on a mesh:

The idea on my mind is to scan the whole mesh and move verts within certain distance to an average position. But I know the down side of this approach is it might also move some verts we don’t want to move.

Just wondering how should I implement it? i’m open to any other ideas to close the gap on the mesh.

Many thanks,
Tawibox

I ask chatCPT how to fix a mesh in babylon.js - but no working answer. So I ask:
Is there an ai tool to fix meshes?

chatGPT: Yes, there are several AI tools available for fixing meshes, particularly for tasks such as mesh repair and optimization. Here are a few examples:

  1. Instant Meshes: Instant Meshes is a free and open-source tool that uses AI algorithms to generate a high-quality quad mesh from a given input mesh. It can be particularly useful for tasks such as remeshing and mesh optimization.
  2. MeshFix: MeshFix is a tool that uses machine learning algorithms to automatically repair and optimize 3D meshes. It can fix common issues such as holes, self-intersections, and non-manifold geometry, and can be particularly useful for preparing meshes for use in other applications.
  3. Autodesk Netfabb: Autodesk Netfabb is a commercial software suite that includes a variety of tools for working with 3D meshes. It uses AI algorithms to automatically repair and optimize meshes, and can be particularly useful for preparing meshes for use in manufacturing applications.
  4. Microsoft MeshLab: Microsoft MeshLab is a cloud-based service that uses AI algorithms to automatically repair and optimize 3D meshes. It can fix common issues such as holes, non-manifold geometry, and self-intersections, and can be particularly useful for preparing meshes for use in 3D printing and other applications.

I hope this helps.

This is not a trivial task you are faced with…

chatGPT:
There are several algorithms that can be used to close a gap on a mesh. Here are a few examples:

  1. Triangulation: Triangulation is a common algorithm used to close gaps in meshes. It involves generating a set of new triangles to fill the gap in the mesh. Triangulation can be performed using a variety of techniques, such as Delaunay triangulation or ear clipping.
  2. Surface Fitting: Surface fitting algorithms use mathematical models to generate a surface that fits the geometry of the mesh around the gap. This surface can then be used to generate new faces to close the gap.
  3. Marching Cubes: Marching Cubes is an algorithm that is commonly used for creating a mesh from a scalar field. It can also be used to close gaps in meshes by generating a set of new faces that fit the geometry of the mesh around the gap.
  4. Patching: Patching algorithms involve generating a set of patches that fit the geometry of the mesh around the gap. These patches can then be used to generate new faces to close the gap.
  5. Geodesic Path: Geodesic path algorithms generate a path between the two edges of the gap, and then generate new faces to fill the gap along this path. This can be particularly useful for closing gaps on meshes with irregular geometry.

These are just a few examples of algorithms that can be used to close gaps in meshes. The specific algorithm that is best suited for your needs may vary depending on the geometry of your mesh and the specific requirements of your application.

Yup stuff involving mesh geometry ends up in the tricky world of computational geometry :slight_smile: Another idea could be to have a look in Blender’s source code since its open to see how they do it?