flatbush_dart 1.2.2 flatbush_dart: ^1.2.2 copied to clipboard
A fast static spatial index for 2D points and rectangles, Dart port of https://github.com/mourner/flatbush/tree/main.
Flatbush Dart #
A fast static spatial index for 2D points and rectangles in Dart, ported from the excellent JavaScript implementation by Volodymyr Agafonkin, and includes the extension for geographic queries.
Usage #
// Initialize Flatbush for a given number type and number of items
final index = Flatbush.double64(1000);
// fill it with 1000 rectangles
for (final p in items) {
index.add(
minX: p.minX,
minY: p.minY,
maxX: p.maxX,
maxY: p.maxY
);
}
// perform the indexing
index.finish();
// make a bounding box query
final found = index.search(
minX: minX,
minY: minY,
maxX: maxX,
maxY: maxY
).map((i) => items[i]);