fn find_clusters<C: CoordinateType + PrimInt>(
    points: &Vec<Point<C>>,
    max_cluster_size: u32,
    max_cluster_span: C
) -> (Vec<u32>, u32)
Expand description

Group points together to clusters and return a vector with the cluster ID for each point and the number of clusters. The clusters are formed as follows:

  1. Sort the points by (x, y).
  2. As long as there’s an unassigned point: take the next unassigned point p and put it into the new cluster c.
  3. Take the closest point to the center of the bounding-box around c. If adding p to c does not enlarge the bounding box around c beyond max_cluster_span then add p to c and repeat 3) otherwise go to 2).
  • max_cluster_size: Maximal number of points in cluster.
  • max_cluster_span: Maximal width and height of the bounding box around the cluster.