JSPM

dbvis-qt

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 37
  • Score
    100M100P100Q50465F
  • License MIT

A TypeScript implementation of the quadtree data structure

Package Exports

  • dbvis-qt

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dbvis-qt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dbvis-qt

npm version Build Status codecov dependencies Status devDependencies Status License: MIT

A TypeScript implementation of the quadtree data structure.

The current version does not support overlapping rectangles yet.

Install

Install with npm:

npm install --save dbvis-qt

This package requires module resolution by Node in tsconfig.json:

{
    "compilerOptions": {
        "moduleResolution": "node"
    }
}

Usage

Example:

import { Point, Quadtree, Rectangle } from 'dbvis-qt';

// Create a quadtree of size 100x100
const qt = Quadtree.createQuadtree<number>(100, 100);
const r = new Rectangle(0, 10, 5, 5);
const d = 6;
// Insert an object (d) associated with an area (r) 
qt.insert(r, d);
const p = new Point(2, 12);
// Retrieve an object with a point, i.e., return the area and the associated
// object if the tree contains a rectangle that encloses the point
let i = qt.retrieve(p);
// i.object = 6; i.rectangle = Rectangle(0, 10, 5, 5)
i = qt.remove(r);
// i.object = 6; i.rectangle = Rectangle(0, 10, 5, 5)
let i = qt.retrieve(p);
// i = undefined;

// ...

qt.clear();