Interface BVH<V extends Bounds2d>

All Superinterfaces:
Bounds2d, Iterable<V>

public interface BVH<V extends Bounds2d> extends Bounds2d, Iterable<V>
A simple, immutable, quadtree-based implementation of a BVH (Bounding Volume Hierarchy) on arbitrary values implementing Bounds2d.
  • Method Details

    • of

      static <V extends Bounds2d> BVH<V> of(@NonNull V[] values)
    • size

      int size()
      Returns:
      the number of values
    • getAllIntersecting

      List<V> getAllIntersecting(@NonNull @NonNull Bounds2d bb)
      Gets a List containing every value that intersects with the given bounding box.
      Parameters:
      bb - the bounding box that values must intersect with
      Returns:
      the values
    • forEachIntersecting

      void forEachIntersecting(@NonNull @NonNull Bounds2d bb, @NonNull @NonNull Consumer<V> callback)
      Runs the given function on every value that intersects with the given bounding box.
      Parameters:
      bb - the bounding box that values must intersect with
      callback - the callback function to run
    • stream

      Stream<V> stream()
      See Also: