TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An interactive explanation of quadtrees (2014)

102 pointsby nbaksalyarover 2 years ago

6 comments

turtledragonflyover 2 years ago
I have had to do some non-trivial work with quadtrees, and one thing I realized, which is not so well-advertised, is that there are really two main categories of quadtrees. So-called &quot;linear&quot; quadtrees are a somewhat different beast that the more typical &quot;pointer to children&quot; ones.<p>They&#x27;re really just different representations of the same thing (a quadtree), but those representations have such different use-cases and performance characteristics that I tend to think of them differently.<p>Linear quadtrees typically use Morton codes (or another space-filling curve), and are good at doing fast queries against static data. You build the tree once, then query it lots. Whereas &quot;standard&quot; quadtrees are more about dynamism — being able to add and remove items quickly.<p>This is a great SO post on dynamic-style quadtrees: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;41946007&#x2F;efficient-and-well-explained-implementation-of-a-quadtree-for-2d-collision-det&#x2F;48330314#48330314" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;41946007&#x2F;efficient-and-w...</a><p>It was quite hard for me to find open-source implementations of linear quadtrees. Whereas there are all kinds of implementations of the more common kind.<p>One day I&#x27;ll open-source my code. I was going back to papers from the &#x27;80s for some of that stuff (:
评论 #34801120 未加载
评论 #34801299 未加载
bfrogover 2 years ago
At one point I wrote a quad tree as part of the Map in SLAM to store probabilities of a point containing an obstacle on a 2d map, the thinking was I could use the quadtree to then navigate the robot.<p>The reality was for the detail I needed at the scale I needed quad trees sort of sucked at this (university is a great place to try and fail at things, I learned a bunch!)<p>I&#x27;d be really curious what is used now, if there&#x27;s some shape estimations to collate points into blobs that are cheaper to store and navigate around. Been awhile since I read any books on robotics and navigation and SLAM though.
stolen_biscuitover 2 years ago
Understanding how quadtrees work was how I finally managed to develop an intuitive grasp of how octrees work. Great to know for any budding voxel enthusiast
chidiwover 2 years ago
Inspired by this post two years ago, I wrote a more comprehensive version: <a href="https:&#x2F;&#x2F;chidiwilliams.com&#x2F;post&#x2F;quadtrees&#x2F;" rel="nofollow">https:&#x2F;&#x2F;chidiwilliams.com&#x2F;post&#x2F;quadtrees&#x2F;</a>. Also showed how quadtrees could be used for compression.
eutecticover 2 years ago
I feel like quadtrees are almost never the best data structure for a given problem. The rare exception being HashLife.
评论 #34798530 未加载
评论 #34798939 未加载
评论 #34797833 未加载
dangover 2 years ago
Discussed at the time:<p><i>An interactive explanation of quadtrees</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7668628" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7668628</a> - April 2014 (19 comments)