A

A non-recursive C Quadtree

Hacker News

A non-recursive C Quadtree

Wazzup Beijing, You might have seen a HSHG written by me the other day (supahero1/hshg, post: https://news.ycombinator.com/item?id=34210305 ), which I also shared here. Well, I've quickly come to the realization that while grids are really nice, they really suck at handling objects of varying sizes. The HSHG could handle 500k objects of very similar sizes at 60FPS, and this Quadtree handles 100k objects of all sizes (can vastly vary or be similar, doesn't matter) in a similar amount of time. Also, while HSHG was really close to being O(n), this Quadtree is much worse, of course resembling O(log n). The way how I achieve lack of recursivity is doing a modified depth-first search. A modified one, because I first add all child nodes to the stack before descending to the first one of them, so the maximum stack length is depth * 3 + 1 , and I assume no madman will want to go over the depth of 20 (by default, can be changed). For some reason, this time around, running this on my laptop actually results in worse performance than I get on my PC, whereas the situation was the reverse with the HSHG haha. No clue why. Some lack of dirty optimizations I suppose. This time, no JavaScript port. I just wanted to whip out this Quadtree real quick (took me a week in total, from scratch) to use in some other project of mine. However, I do hope some people can make use of it, or maybe learn how non-recursive Quadtrees work, idk. On the other hand, this time I included a nice OpenGL + GLFW display showing exactly what's happening and how the Quadtree divides and merges its nodes. You can move around with your mouse (by dragging), and you can click LMB to warp to the fastest object in your view, which then you can deactivate (stop following the entity) by pressing RMB. Hope you enjoy! ~don_shadaman

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: new, open · Missing: mac, agents, macos
84%84% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
70%70% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
56%56% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
42%42% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
34%34% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
16%16% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

Si
Sitekite 2, PHPMyAdmin for non-programmers63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Sitekite 2, PHPMyAdmin for non-programmers

Hacker News2
Eg
Ego-Splitting: From Non-Overlapping to Overlapping Clusters (KDD 17)51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ego-Splitting: From Non-Overlapping to Overlapping Clusters (KDD 17)

Hacker News2
Eg
Ego-Splitting: From Non-Overlapping to Overlapping Clusters51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ego-Splitting: From Non-Overlapping to Overlapping Clusters

Hacker News5
No
Non Incendiary Feral Hog Elimination Ordinance50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Non Incendiary Feral Hog Elimination Ordinance

Hacker News1
Cr
Create aliases with non deterministic arguments39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Create aliases with non deterministic arguments

Hacker News2
bf
bfc – A fast non-JIT brainfuck interpreter54%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

bfc – A fast non-JIT brainfuck interpreter

Hacker News1
No
Non Interactive ZKP with Fiat-Shamir Heuristic and ECC in Go46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Non Interactive ZKP with Fiat-Shamir Heuristic and ECC in Go

Hacker News4
Vu
Vue-Pagination – Non-style pagination for every frameworks49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Vue-Pagination – Non-style pagination for every frameworks

Hacker News1
Ro
RobotFindsKitten non-kitten-item server in Go50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

RobotFindsKitten non-kitten-item server in Go

Hacker News3
Fo
Fourplex – public IPv4 and IPv6 addresses over non-IPsec L2TP43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Fourplex – public IPv4 and IPv6 addresses over non-IPsec L2TP

Hacker News1