A QuadTree example (and almost sort of a JavaScript library) with p5.js.
- QuadTree on wikipedia
- QuadTree pseudo-code
- QuadTree video tutorial 1
- QuadTree video tutorial 2
- QuadTree video tutorial 3
- 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);
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
- Carla de Beer (Processing port) - GitHub