6

Quadtrees are used as an optimisation in games and elsewhere for spatial organisation of entities http://en.wikipedia.org/wiki/Quadtree.

Are there any examples of quadtrees being used for HTML5 Canvas?

VividD
  • 10,456
  • 6
  • 64
  • 111
Sycren
  • 539
  • 2
  • 5
  • 15

2 Answers2

5

I think you should visit Mike Chambers.

Using Easel JS.

http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/

goodboy
  • 66
  • 1
2

HTML5 canvas is merely a standard that doesn't define it's particular implementation. However I still doubt that canvas's will use quadtrees in their implementation. Quadtrees are mainly used for efficient collision detection and in general storing spatial data.

On the other hand, a canvas acts as a bitmap which is more naturally stored as a pixel array. There isn't any notion of "colliding" objects so each element is drawn independently of the previous ones.

tskuzzy
  • 35,812
  • 14
  • 73
  • 140