Vertices with normals to simple mesh with faces

282 views Asked by At

Similar to this question: Using just vertices to generate faces in PyMeshLab

I am looking for a function in either PyVista or PyMeshLab which constructs a mesh surface given vertices. However, my vertices already have normals. They were obtained with a laser scanner, so I used the estimate normals function in CloudCompare knowing the sensor locations that the points were obtained from. Therefore, all my point cloud normals are true surface normals. I want to preserve this information.

All I really need is to march through the cloud and connect the vertices with faces of their nearest neighbors. That is, I would like my point cloud to be the mesh vertices. No Delaunay triangulations or anything like that. No ball pivoting algorithm or Poisson reconstruction that skips over some points. My points are already subsampled and sparse.

Are there any functions that can do this? Maybe it is even easy to do manually.

Thank you.

For example, in this code, nbr_sz dictates the neighborhood of points to look around for estimating surface normals.

import pyvista as pv

bunny = pv.read("Stanford_Bunny.ply")

points = pv.wrap(bunny.points)
surf = points.reconstruct_surface(nbr_sz=10)

pl = pv.Plotter(shape=(1, 2))
pl.add_mesh(points)
pl.add_title("Point Cloud of 3D Surface")
pl.subplot(0, 1)
pl.add_mesh(surf, color=True, show_edges=True)
pl.add_title("Reconstructed Surface")
pl.show()

See https://docs.pyvista.org/api/core/_autosummary/pyvista.PolyDataFilters.reconstruct_surface.html#pyvista.PolyDataFilters.reconstruct_surface

0

There are 0 answers