/p5.things

Quadtree Data Structure

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

bits

bits is a repository of data structures and algorithms used in the context of creating living things inspired by nature, code and mathematics. The project was designed to be used with p5.js for practical and educational purposes.

Install

You can install the library via npm :

$ npm install git+https://github.com/itsKaspar/bits.git

or download a minified version here and include it in your project this way :

<script src="bits.min.js"></script>

Usage

You can open the examples folder for an example of each of the data structures and or algorithms

Creating a new quadtree

let qtree = new quadtree.Quadtree();

Inserting a point

qtree.insert({x, y});

Get all points within a circle of position {cx, cy} and radius r

const request = qtree.query(cx, cy, r);

This will return an array of points within the range

Kaspar Ravel
@. kaspar.ravel@gmail.com
w. kaspar.wtf
ig. @kaspar.wtf