Class: QuadTree

me. QuadTree

new QuadTree(bounds, max_objects, max_levels, level)

Quadtree Constructor
note: the global quadtree instance is available through `me.collision.quadTree`
Parameters:
Name Type Argument Default Description
bounds me.Rect bounds of the node
max_objects Number <optional>
4 max objects a node can hold before splitting into 4 subnodes
max_levels Number <optional>
4 total max levels inside root Quadtree
level Number <optional>
deepth level, required for subnodes
Source:
quadtree.js, line 49
See:

Extends

Methods

<static> clear()

clear the quadtree
Source:
quadtree.js, line 353

<static> hasChildren()

return true if the node has any children
Source:
quadtree.js, line 336
Returns:
true if the node has any children

<static> insert(item)

Insert the given object into the node. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
Parameters:
Name Type Description
item Object object to be added
Source:
quadtree.js, line 199

<static> insertContainer(container)

Insert the given object container into the node.
Parameters:
Name Type Description
container me.Container group of objects to be added
Source:
quadtree.js, line 174

<static> isPrunable()

return true if the node is prunable
Source:
quadtree.js, line 325
Returns:
true if the node is prunable

<static> remove(object)

Remove the given item from the quadtree. (this function won't recalculate the impacted node)
Parameters:
Name Type Description
object Object object to be removed
Source:
quadtree.js, line 283
Returns:
true if the item was found and removed.

<static> retrieve(object, function) → {Array.<Object>}

Return all objects that could collide with the given object
Parameters:
Name Type Argument Description
object Object object to be checked against
function Object <optional>
a sorting function for the returned array
Source:
quadtree.js, line 247
Returns:
array with all detected objects
Type
Array.<Object>
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:41+08:00 using the DocStrap template modified by codename-.