Class SpatiallySeparate<T>

Object
SpatiallySeparate<T>
Type Parameters:
T - the element-type in the collection.

public class SpatiallySeparate<T> extends Object
Splits a collection of elements into spatially separate clusters.

Each element must provide a corresponding bounding-box.

Any objects whose bounding-boxes intersect belong to the same cluster, but otherwise not.

This is similar to a simplified DBSCAN algorithm.

Author:
Owen Feehan
  • Constructor Details

    • SpatiallySeparate

      public SpatiallySeparate(Function<T,BoundingBox> extractBoundingBox)
      Creates a new SpatiallySeparate instance.
      Parameters:
      extractBoundingBox - Extracts a bounding-box from a particular element.

      This operation is assumed to have low computational cost.

  • Method Details

    • separate

      public List<Set<T>> separate(Collection<T> elements)
      Splits a collection of elements into spatially separate clusters, without consuming all elements in elements.
      Parameters:
      elements - the collection of elements to separate.
      Returns:
      a list of object-collections, each object-collection is guaranteed to be spatially separate from the others.