Skip to content

CodingTrain/QuadTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A QuadTree example (and almost sort of a JavaScript library) with p5.js.

QuadTree

How to use

  • You can download and include quadtree.js in your p5 sketch or refer to it via this CDN link:
<script src="https://cdn.jsdelivr.net/gh/CodingTrain/QuadTree/quadtree.js"></script>

Once you've include the library you can create a QuadTree object a Rectangle boundary and maximum capacity:

const r = new Rectangle(0, 0, width, height);
const capacity = 4;
const quadtree = new QuadTree(r, capacity);

Testing

To run tests use one of the following commands

For continuous testing

npm run test-watch

For a single run test, with coverage

npm run test

This will output to the coverage folder where you can few test coverage by opening index.html

Other QuadTree libraries in JS

Other Versions

Ports to other languages

  • Carla de Beer (Processing port) - GitHub
  • Alix Poulsen (Kit port) - Github