Functional Quadtrees
lbjgruppen.com·3d·
Discuss: Hacker News
🌳Huffman Trees
Preview
Report Post

A Quadtree is a tree data structure, which is useful for giving more focus/detail to certain regions of your data, while saving resources elsewhere. I could only find a couple tutorials/guides and both were imperative, so I figured it’d be fun to do a functional version in Clojure which runs in the browser.

A demo

In this blogpost I’ll show you how to build both a functional Quadtree and the visualization you see below. Imagine the canvas to be a top-view of map and your mouse-position to be the spot you’re occupying on the map. Near you, you want crisp details, small cells of high resolution. The further away we get from you/the camera (your mouse-position), the less we care about details.

Be aware that on mobile, you have to click a…

Similar Posts

Loading similar posts...