Quadtree

Process
- Add some
{ x, y }points to a 2D space. In this example, the point’s positions are random but biased towards a focal point. - Subdivide the space into quadrants based on the density/position of the points
- Store a reference to the resulting rectangles (these are the grid areas)
- Use the resulting grid areas to position stuff! In the example above, I am using squares and circles to form a simple pattern.
Once the Quadtree fills with a certain number of objects, it splits itself into four more Quadtrees. Once those Quadtrees fill up, they divide themselves again, and so on.
source: https://georgefrancis.dev/writing/generative-grid-layouts-with-quadtrees/