Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2014-7-16 16:20

Class jaws.QuadTree

Class Summary
Constructor Attributes Constructor Name and Description
 
jaws.QuadTree(bounds, depth)
Creates an empty quadtree with optional bounds and starting depth

Method Summary

Method Attributes Method Name and Description
 
Moves through the nodes and deletes them.
 
collide(list1, list2, callback)
Checks for collisions between objects by creating a quadtree, inserting one or more objects, and then comparing the results of a retrieval against another single or set of objects.
 
insert(pRect)
Inserts an object into the quadtree, spliting it into new branches if needed
 
retrieve(pRect)
Returns those objects on the branch matching the position of the passed-in object

Class Detail

jaws.QuadTree(bounds, depth)
Creates an empty quadtree with optional bounds and starting depth
Parameters:
{jaws.Rect} bounds Optional
The defining bounds of the tree
{number} depth Optional
The current depth of the tree

Method Detail

  • clear()
    Moves through the nodes and deletes them.
  • {boolean} collide(list1, list2, callback)
    Checks for collisions between objects by creating a quadtree, inserting one or more objects, and then comparing the results of a retrieval against another single or set of objects. With the callback argument, it will call a function and pass the items found colliding as the first and second argument. Without the callback argument, it will return a boolean value if any collisions were found.
    Parameters:
    {object|array} list1
    A single or set of objects with properties x, y, width, and height
    {object|array} list2
    A single or set of objects with properties x, y, width, and height
    {function} callback Optional
    The function to call per collision
    Returns:
    {boolean} If the items (or any within their sets) collide with one another
  • insert(pRect)
    Inserts an object into the quadtree, spliting it into new branches if needed
    Parameters:
    {object} pRect
    An object with the properties x, y, width, and height
  • {array} retrieve(pRect)
    Returns those objects on the branch matching the position of the passed-in object
    Parameters:
    {object} pRect
    An object with properties x, y, width, and height
    Returns:
    {array} The objects on the same branch as the passed-in object