napari-process-points-and-surfaces
napari-process-points-and-surfaces copied to clipboard
Improve fill holes example
Currently, on the open3d-vedo-conversion branch, in the demo notebook, there is example code for fill holes:
surface = vedo_points_to_convex_hull_surface(points_layer.data)
faces_del = np.delete(surface[1], np.random.randint(0, surface[1].shape[0], 10), axis=0)
viewer.add_surface((surface[0], faces_del), name='Surface with hole')
and
hide_all(viewer)
viewer.add_surface(vedo_fill_holes((surface[0], faces_del), size_limit=1000), name='Filled hole')
nbscreenshot(viewer)
I do not understand this example and the code. What is (surface[0], faces_del)? Would it be possible to give this thing a name, by storing it in a variable? The three related screenshots look the same. We should improve this example. Maybe, it would be better suited to do that with a different dataset.
@jo-mueller I think you introduced this example and fill_holes. Would you mind taking a look? Thanks
Hi @haesleinhuepf ,
thanks for pointing it out, I have improved the example. What the code basically does is:
- create a convex hull (it's just much easier to spot holes in the convex hull mesh rather than the raw mesh)
- creates a copy of the
facespart of the surface tuple (faces = surface[1]) and randomly removes some of the faces from the list of all faces to create a mesh with holes. - Adds a new surface tuple with missing faces (
surface[0], faces_del) wherefaces_delis the copy of the list of faces with some of the entries deleted - Fixes the holes in the mesh with holes
(surface[0], faces_del).
I have changed the example a bit so that the hole in the mesh is better visible and the code is cleaner. PR coming