Skip to content

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:
<scriptsrc="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:

constr=newRectangle(0,0,width,height);constcapacity=4;constquadtree=newQuadTree(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

About

A QuadTree Example for JavaScript (with p5.js)

Topics

Resources

Stars

143 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages