New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@4bitlabs/quadtree

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4bitlabs/quadtree

A basic 2D quadtree (2×2 spatial division) for fast, efficient spatial queries

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-16.67%
Maintainers
0
Weekly downloads
 
Created
Source

@4bitlabs/quadtree License NPM Version NPM Downloads

Quadtree split illustration

Installing

$ npm install --save @4bitlabs/quadtree
$ yarn add @4bitlabs/quadtree
$ pnpm add @4bitlabs/quadtree

Usage

import { quadtree } from '@4bitlabs/quadtree';

interface Entity {
  /* whatever you like */
}

type Bounds = [left: number, top: number, right: number, bottom: number];

function getBounds(it: Entity): Bounds {
  /* determine bounds for entity, specified in  */
}

const space = quadtree<Entity>([0, 0, 1000, 1000], Entity.prototype.getBounds);

Options

quadtree() accept a third argument of options:

optionDescriptionDefaults
maxDepthThe maximum depth/subdivisions that the graph will divide.7
maxChildrenThe maximum number of objects in a node before it will split10
const space = quadtree<Entity>([0, 0, 1000, 1000], Entity.prototype.getBounds, {
  maxDepth: 5,
  maxChildren: 50,
});

Keywords

FAQs

Package last updated on 15 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc