mourner / Kdbush
Licence: isc
A fast static index for 2D points
Stars: ✭ 412
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Kdbush
Polysnap
A work in progress polygon operations library with integer snap-rounding
Stars: ✭ 14 (-96.6%)
Mutual labels: algorithm, computational-geometry, fast
Geokdbush
The fastest spatial index for geographic locations in JavaScript
Stars: ✭ 251 (-39.08%)
Mutual labels: algorithm, computational-geometry, fast
Delaunator
An incredibly fast JavaScript library for Delaunay triangulation of 2D points
Stars: ✭ 1,641 (+298.3%)
Mutual labels: algorithm, computational-geometry, fast
Supercluster
A very fast geospatial point clustering library for browsers and Node.
Stars: ✭ 1,246 (+202.43%)
Mutual labels: algorithm, computational-geometry
Turf
A modular geospatial engine written in JavaScript
Stars: ✭ 6,659 (+1516.26%)
Mutual labels: algorithm, computational-geometry
Flatbush
A very fast static spatial index for 2D points and rectangles in JavaScript
Stars: ✭ 1,031 (+150.24%)
Mutual labels: algorithm, computational-geometry
Xseries
Library for cross-version Minecraft Bukkit support and various efficient API methods.
Stars: ✭ 109 (-73.54%)
Mutual labels: algorithm, fast
Earcut
The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
Stars: ✭ 1,359 (+229.85%)
Mutual labels: algorithm, computational-geometry
Turf Swift
A Swift language port of Turf.js.
Stars: ✭ 123 (-70.15%)
Mutual labels: algorithm, computational-geometry
Rbush
RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles
Stars: ✭ 1,881 (+356.55%)
Mutual labels: algorithm, computational-geometry
Cavaliercontours
2D polyline library for offsetting, combining, etc.
Stars: ✭ 135 (-67.23%)
Mutual labels: algorithm, computational-geometry
Greinerhormann
Greiner-Hormann polygon clipping algorithm. Does AND, OR, XOR. Plays nicely with Leaflet. Handles non-convex polygons and multiple clipping areas. ~3kb footprint, no dependencies
Stars: ✭ 176 (-57.28%)
Mutual labels: algorithm, computational-geometry
Ahocorasickdoublearraytrie
An extremely fast implementation of Aho Corasick algorithm based on Double Array Trie.
Stars: ✭ 695 (+68.69%)
Mutual labels: algorithm, fast
Data structure and algorithms library
A collection of classical algorithms and data-structures implementation in C++ for coding interview and competitive programming
Stars: ✭ 133 (-67.72%)
Mutual labels: algorithm, computational-geometry
Skeleton Tracing
A new algorithm for retrieving topological skeleton as a set of polylines from binary images
Stars: ✭ 241 (-41.5%)
Mutual labels: algorithm, computational-geometry
Delaunator Cpp
A really fast C++ library for Delaunay triangulation of 2D points
Stars: ✭ 244 (-40.78%)
Mutual labels: algorithm, computational-geometry
Competitive coding
This repository contains some useful codes, techniques, algorithms and problem solutions helpful in Competitive Coding.
Stars: ✭ 393 (-4.61%)
Mutual labels: algorithm
Whatlang Rs
Natural language detection library for Rust. Try demo online: https://www.greyblake.com/whatlang/
Stars: ✭ 400 (-2.91%)
Mutual labels: algorithm
Martinez
Martinez-Rueda polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
Stars: ✭ 391 (-5.1%)
Mutual labels: computational-geometry
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
const index = new KDBush(points); // make an index
const ids1 = index.range(10, 10, 20, 20); // bbox search - minX, minY, maxX, maxY
const ids2 = index.within(10, 10, 5); // radius search - x, y, radius
Install
Install using NPM (npm install kdbush
) or Yarn (yarn add kdbush
), then:
// import as a ES module
import KDBush from 'kdbush';
// or require in Node / Browserify
const KDBush = require('kdbush');
Or use a browser build directly:
<script src="https://unpkg.com/[email protected]/kdbush.min.js"></script>
API
new KDBush(points[, getX, getY, nodeSize, arrayType])
Creates an index from the given points.
-
points
: Input array of points. -
getX
,getY
: Functions to getx
andy
from an input point. By default, it assumes[x, y]
format. -
nodeSize
: Size of the KD-tree node,64
by default. Higher means faster indexing but slower search, and vise versa. -
arrayType
: Array type to use for storing coordinate values.Float64Array
by default, but if your coordinates are integer values,Int32Array
makes things a bit faster.
const index = new KDBush(points, p => p.x, p => p.y, 64, Int32Array);
index.range(minX, minY, maxX, maxY)
Finds all items within the given bounding box and returns an array of indices that refer to the items in the original points
input array.
const results = index.range(10, 10, 20, 20).map(id => points[id]);
index.within(x, y, radius)
Finds all items within a given radius from the query point and returns an array of indices.
const results = index.within(10, 10, 5).map(id => points[id]);
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].