pyFM.mesh.geometry.farthest_point_sampling

pyFM.mesh.geometry.farthest_point_sampling(d, k, random_init=True, n_points=None, verbose=False)

Sample points using farthest point sampling.

Uses either a complete distance matrix or a function giving distances to a given index i.

Parameters:
  • d ((n, n) np.ndarray or callable) – Either a distance matrix between points, or a function computing geodesic distance from a given index.

  • k (int) – Number of points to sample.

  • random_init (bool, optional) – Whether to sample the first point randomly or to take the one furthest away from all the others. Only used if d is a distance matrix.

  • n_points (int, optional) – In the case where d is callable, specifies the size of the output.

  • verbose (bool, optional) – Whether to display a progress bar.

Returns:

fps – Array of indices of sampled points.

Return type:

(k,) np.ndarray