code: def farthest_point_sample(point, npoint):
      """
      Farthest point sampler works as follows:
      1. Initialize the sample set S with a random point
      2. Pick point P not in S, which maximizes the distance d(P, S)
      3. Repeat step 2 until |S| = npoint
  
      Input:
          xyz: pointcloud data, [N, D]
          npoint: number of samples
      Return:
          centroids: sampled pointcloud index, [npoint, D]
      """
      N, D = point.shape
      xyz = point[:, :3]
      centroids = np.zeros((npoint,))
      distance = np.ones((N,)) * 1e10
      farthest = np.random.randint(0, N)
      for i in range(npoint):
          centroids[i] = farthest
          centroid = xyz[farthest, :]
          dist = np.sum((xyz - centroid) ** 2, -1)
          mask = dist < distance
          distance[mask] = dist[mask]
          farthest = np.argmax(distance, -1)
      point = point[centroids.astype(np.int32)]
      return point
  
file_path: dgl/examples/pytorch/pointcloud/pointnet/ModelNetDataLoader.py
imports: import os
  import warnings
  import numpy
  from torch.utils.data import Dataset
label_desc: Use image node_id 2 for calling a global function with example usage: farthest_point_sample(point, npoint) and returns: point