def Farthest_Point_Sampling(mesh_name,n): """ add the new farest point to set and print n out of all of mesh :param mesh_name: :param n: :return: """ mesh = read(mesh_name + ".ply") v, f = (np.array(mesh.points), np.array(mesh.cells_dict['triangle'], dtype=np.int32)) geodesics_dist = gdist.local_gdist_matrix(v.astype(np.float64), f.astype(np.int32)) mesh = Mesh(v=v,f=f) mesh.render_pointcloud(scalar_function=mesh.gaussianCurvature()) s=[] s.append(np.random.randint(0, len(v))) while (len(s)!=n): max_dist = 0 selected_v = None for i,v_i in enumerate(v): min_by_s = np.inf for s_i in s: #get minimum ovver all s_i dist = geodesics_dist[s_i][v_i] if dist < min_by_s: min_by_s = dist if min_by_s > max_dist: max_dist = min_by_s selected_v = v_i v = np.delete(v,selected_v) #dont iterate v over this node anymore s.append(selected_v) f_new=gen_f(s) mesh = Mesh(v=v[np.array(s)], f=f_new) mesh.render_pointcloud(scalar_function=mesh.gaussianCurvature())