Skip to content
sombra2eternity edited this page Mar 1, 2014 · 1 revision

Welcome to the quadtree wiki!

The motivations to create this project was to implement a basic algorithm in javascript (Quadtree) to detect collisions.

I have seen another implementations but most of them seems to have some level of artifacts or corner cases. The method set is highly inspired on this try from timohausmann: quadtree-js example here

Common bugs solved

Bugs and corner cases present in other approachs.

Ramdom Squares collisions detected

Quadtree Artifacts

This is one of the bad behaviours commonly detected, not only the nearest squares are marked as positives but some others in the Cartesian axis or randomly positioned.

Correct Quadtree

Current implementation. This is how it should behave, discarding all squares far from our collision zone.

Middle corner case

Quadtree corner case

This is another common bug present in most implementations. When you hold your collision zone between four spaces those scripts are unable to handle this cases and start processing all present squares.

Correct Quadtree

Current implementation. This should be a much more correct handle, this implementation discards far squares even in a difficult case like this.