title: Closing holes in mesh while retaining point cloud shape
body: <p>I have a ply file that I am attempting to turn into a mesh for the purposes of ray tracing. It looks like this is the open3d visualizer and is supposed to represent a part of a city:
  <a href="https://i.stack.imgur.com/jkulo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jkulo.jpg" alt="enter image description here" /></a></p>
  <p>I used open3d to get make the following mesh as following(kdtree is just to get small number of points as file is huge):</p>
  <pre><code>input_file = &quot;san.ply&quot;
  pcd = o3d.io.read_point_cloud(input_file)
  point_cloud_in_numpy = np.asarray(pcd.points)
  color = np.asarray(pcd.colors)
  kd = scipy.spatial.cKDTree(point_cloud_in_numpy) #create kdtree for fast querying
  near = kd.query_ball_point([0, 0, 0], 100)
  items = point_cloud_in_numpy[near]
  colors = color[near]
  pcd2 = o3d.geometry.PointCloud()
  
  pcd2.colors = o3d.utility.Vector3dVector(colors)
  pcd2.points = o3d.utility.Vector3dVector(items)
  
  pcd2.estimate_normals()
  
  distances = pcd2.compute_nearest_neighbor_distance()
  avg_dist = np.mean(distances)
  radius = 2 * avg_dist
  
  mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(
         pcd2,
         o3d.utility.DoubleVector([radius, radius * 2]))
  
  vertices = np.asarray(mesh.vertices)
  faces = np.asarray(mesh.triangles)
  
  o3d.visualization.draw_geometries([mesh])
  </code></pre>
  <p>However, when graphing the mesh, we get something that looks like this:
  <a href="https://i.stack.imgur.com/p83OA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p83OA.png" alt="enter image description here" /></a>
  Many holes and just not at all optimal for ray tracing. I also tried using the <code>create_from_point_cloud_poisson</code> method instead however I kept on getting the following error:</p>
  <pre><code>[ERROR] /Users/yixing/repo/Open3D/build/poisson/src/ext_poisson/PoissonRecon/Src/FEMTree.IsoSurface.specialized.inl (Line 1463)
          operator()
          Failed to close loop [6: 87 64 18] | (113981): (2752,2560,2196)
  </code></pre>
  <p>which I found no way to fix online. I tried looking around but the best I found was pymeshfix which doesn't even work because &quot;The input is assumed to represent a single closed solid object&quot;, which my point cloud is obviously not. I'm just looking for a good way to perform surface reconstruction that lets me keep the shape of the city while also fixing all the holes and making all surfaces created by points near eachother surfaces watertight.</p>