For balancing computational loads, the function uses
the anticlust
package to cluster the input points. The number of clusters
is determined by the num_cluster
argument. Each cluster will have
equal number of points. Grids will be generated based on the cluster
extents. At the lower level, the function uses terra::distance()
function to calculate the Euclidean distance between points.