(width, height float32)
| 94 | } |
| 95 | |
| 96 | func calcMaxLevel(width, height float32) int { |
| 97 | res := 0 |
| 98 | for width > minQuadtreeCellSize && height > minQuadtreeCellSize { |
| 99 | res++ |
| 100 | width, height = width/2, height/2 |
| 101 | } |
| 102 | return res |
| 103 | } |
| 104 | |
| 105 | // NewQuadtree creates a new quadtree for the given bounds. |
| 106 | // When setting usePool to true, the internal values will be taken from a sync.Pool which reduces the allocation overhead. |