Skip to content

marchello2000/kdbush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kdbush

C# KD-Bush implementation

Build status

Based on this JavaScript implementation by Vladimir Agafonkin

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

using KDBush

KDBush<int> kdbush = new KDBush<int>();

List<Point<int>> points = new List<Point<int>>(){
    new Point<int>(54, 1, 0),
    new Point<int>(97, 21, 1)
};

kdbush.Index(points);

// Get all points that lie inside the rectangle 
// (20, 30)-(50, 70)
var result = kdbush.Query(20, 30, 50, 70);

// Get all points that lie inside the circle 
// centered at (50, 50) with radius 20
result = kdbush.Query(50, 50, 20);

About

C# KD-Bush implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages