#kd-tree #spatial #geometry

kdbush

A very fast static spatial index for 2D points based on a flat KD-tree

2 unstable releases

0.2.0 Apr 21, 2020
0.1.0 Jun 17, 2017

#398 in Math

Download history 33/week @ 2022-12-06 43/week @ 2022-12-13 65/week @ 2022-12-20 31/week @ 2022-12-27 24/week @ 2023-01-03 29/week @ 2023-01-10 32/week @ 2023-01-17 55/week @ 2023-01-24 66/week @ 2023-01-31 51/week @ 2023-02-07 39/week @ 2023-02-14 62/week @ 2023-02-21 75/week @ 2023-02-28 77/week @ 2023-03-07 45/week @ 2023-03-14 21/week @ 2023-03-21

223 downloads per month
Used in 4 crates

ISC license

15KB
317 lines

kdbush

crates.io Documentation

A Rust port of kdbush, a very fast static spatial index for 2D points based on a flat KD-tree.

Introduction: A dive into spatial search algorithms

Comparison of point and box spatial index libraries.

Usage

let points = vec![(54.0, 1.0), (97.0, 21.0), (65.0, 35.0)];
let index = KDBush::create(points, kdbush::DEFAULT_NODE_SIZE); // make an index
index.range(20.0, 30.0, 50.0, 70.0, |id| print!("{} ", id));   // bbox search - minX, minY, maxX, maxY
index.within(50.0, 50.0, 20.0, |id| print!("{} ", id));        // radius search - x, y, radius

No runtime deps