Тап по тысяче точек за O(log n): QuadTree и сферическая геометрия в гео-соцсети

9 лет назад я разрабатывал геолокационную соц.сеть на заказ, где мы отображали чаты на карте. До релиза не дошло, но интересного опыта было получено много. В очередной статье из серии рассказываю про то, как обрабатывать нажатия на MapBox и любой другой карте (Google, Yandex – не важно) и находить нужные объекты на ней, привязанные к координатам.

https://habr.com/ru/articles/1051948/

#iOS #Swift #алгоритмы #QuadTree #структуры_данных #пространственный_индекс #сферическая_геометрия #Mapbox #карты #оптимизация

Тап по тысяче точек за O(log n): QuadTree и сферическая геометрия в гео-соцсети

В прошлой части я рассказывал, как я ушел от UIView-аннотаций на карте и начал рисовать облака через GL-слои. FPS от этого действительно стал сильно лучше: карта перестала страдать от тысяч...

Хабр

Тап по тысяче точек за O(log n): QuadTree и сферическая геометрия в гео-соцсети

Как-то раз я разрабатывал геолокационную соцсеть. Эта статья – продолжение предыдущей, в ней описывается, как определить, на что на карте нажал пользователь, если движок нам не предоставляет такую информацию. Как только маркеры на карте перестают быть UIView и становятся точками в GL-слое, карта больше не знает, на что ты тапнул: она отдаёт только координату пальца, а дальше твои проблемы. Разбираю, как клиентский QuadTree на плоскости сферического меркатора превращает «на какое из тысячи облаков я попал» и «какие показать в кадре» из O(n)-перебора в спуск по дереву за O(log n). Заодно — зачем для перевода «пиксели ↔ метры ↔ координаты» пришлось портировать в Swift кусок сферической тригонометрии из Google Maps Utils, и почему «честный» top-N в отборе аур проиграл намеренно неравномерному 20/60/20.

https://habr.com/ru/articles/1051694/

#алгоритмы #QuadTree #структуры_данных #пространственный_индекс #сферическая_геометрия #Mapbox #карты #оптимизация

Тап по тысяче точек за O(log n): QuadTree и сферическая геометрия в гео-соцсети

В прошлой части мы научились рисовать на карте тысячи облаков, не убивая FPS, – перенесли рендер с UIView-аннотаций на GL-слои. Но у этого решения есть оборотная сторона, про которую я тогда умолчал....

Хабр
lol turn any image into Caves of Qud / Dwarf Fortress...
#quadtree
🥳 Ah, the timeless joy of explaining quadtrees to an audience who couldn't care less! 🌳 Why not just spend an afternoon watching paint dry instead? 🎨 It's a hands-on guide to wasting perfectly good processor cycles while pretending to teach efficiency! 🕰️
https://growingswe.com/blog/quadtrees #quadtree #humor #inefficiency #tech #education #programming #HackerNews #ngated
An interactive intro to quadtrees

An interactive exploration of quadtrees. Start with brute-force spatial search, build recursive space partitioning step by step, then use it for point lookups, range queries, nearest-neighbor search, collision detection, and image compression.

Flocking Quadtrees

Learn how to make a flocking simulation using Quadtrees and Clojurescript. It's a revisit of last weeks post about Functional Quadtrees.

🤔🎨 Ah, yes, yet another attempt to make data structures "fun" by shoehorning them into #Clojure. Who wouldn't want to spend their weekend navigating a "functional" #quadtree demo that ironically leaves mobile users clicking aimlessly? 📱🔍
https://lbjgruppen.com/en/posts/functional-quadtree-clojure #dataStructures #functionalProgramming #UXdesign #HackerNews #HackerNews #ngated
Functional Quadtrees

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.

🌘 函數式 Quadtree:Clojure 實現與瀏覽器視覺化
➤ 以函數式思維在 Clojure 中構建動態細節的空間分割樹
https://lbjgruppen.com/en/posts/functional-quadtree-clojure
本文介紹如何使用 Clojure 建構一個函數式的 Quadtree 資料結構,並在瀏覽器中實現互動式視覺化。作者說明瞭傳統的命令式方法需要手動管理節點更新,而函數式方法則透過遞迴重建整個樹狀結構,以達到簡潔且易於維護的目標。文中詳細闡述了節點的定義、判斷分割的邏輯,以及如何利用 Clojure 的 `prewalk` 函數來進行樹狀結構的遍歷和轉換。此外,文章也探討瞭如何透過 ClojureScript 的原子 (atom) 和 `add-watch` 機制,將 Quadtree 的變更即時反映在瀏覽器的 Canvas 視覺化上,並分享了使用雜湊函數為節點生成固定顏色的技巧,以避免畫面閃爍。
+ 太棒了!一直想找函數式處理空間分割的範例,這篇寫得非常清晰
#程式設計 #Clojure #Quadtree #函數式程式設計 #瀏覽器
Functional Quadtrees

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.

Coal Town / quadtree division and 1bit texture placement

#bitmap #quadtree #texture #grit #vectorart #artgénératif #noiretblanc

Today might be the day where I implement a quadTree for the first time. I have never needed it before but I do think I need it now, as the frame rate went way down when I added very basic collision detection to my mini-game-engine.

But I'll have to wait an see if I actually get to have the time to do it today. 🤞

#gamedev #miniEngine #quadtree