init(boundingQuad:minimumCellSize:)
Initializes a quadtree with the specified dimensions.
Declaration
init(boundingQuad quad: GKQuad, minimumCellSize minCellSize: Float)Parameters
- quad:
The axis-aligned bounding rectangle encompassing all possible elements of the tree. Elements added to the tree must lie entirely within this rectangle.
- minCellSize:
The minimum dimension (width and height) of a node in the tree.
Return Value
A new quadtree object.
Discussion
The minCellSize parameter controls the memory usage and performance of the tree. A lower value causes the tree to make more spatial divisions when adding elements; a higher value causes the tree to create fewer such divisions, but store more elements in each node. Which direction leads to better performance depends on the number and spatial arrangement of the elements you add to the tree—for best results, profile with different values to find one best suited to your app or game.