msfstef / flatbush-dart

Dart port of https://github.com/mourner/flatbush

Home Page:https://pub.dev/packages/flatbush_dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flatbush Dart

Pub License

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]);

About

Dart port of https://github.com/mourner/flatbush

https://pub.dev/packages/flatbush_dart

License:ISC License


Languages

Language:Dart 100.0%