Skip to content

Naive implementation of Java KD-Bush(KD-tree) algorithm

Notifications You must be signed in to change notification settings

imvladikon/kdbush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

kdbush

Java KD-Bush implementation

Based on this JavaScript implementation by Vladimir Agafonkin and on this C# implementation by marchello2000

KD-Bush is a very fast static spatial index for 2D points based on a flat KD-tree.
Compared to RBush:

  • points only — no rectangles
  • static — you can't add/remove items
  • indexing is 5-8 times faster

Usage

Double[][] pointsData =  new Double[][] {
                new Double[]{24.0, 35.0}, 
                new Double[]{37.0, 41.0},
                new Double[]{65.0, 35.0}
                };
KDBush index = new KDBush<Double[]>(pointsData);

// Get all points that lie inside the rectangle 
// (20, 30)-(50, 70)
List<Integer> ids1 = index.range(20, 30, 50, 70); 

// Get all points that lie inside the circle 
// centered at (50, 50) with radius 20
List<Integer> ids2 = index.within(20, 30, 50); 

About

Naive implementation of Java KD-Bush(KD-tree) algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages