src/physics/SimplePhysics/HSHG.js
/**
 * Updates every object's position in the grid, but only if
 * the hash value for that object has changed.
 * This method DOES NOT take into account object expansion or
 * contraction, just position, and does not attempt to change
 * the grid the object is currently in; it only (possibly) changes
 * the cell.
 *
 * If the object has significantly changed in size, the best bet is to
 * call removeObject() and addObject() sequentially, outside of the
 * normal update cycle of HSHG.
 *
 * @return  void   desc
 */
Updates every object's position in the grid, but only if
the hash value for that object has changed.
This method DOES NOT take into account object expansion or
contraction, just position, and does not attempt to change
the grid the object is currently in; it only (possibly) changes
the cell.

If the object has significantly changed in size, the best bet is to
call removeObject() and addObject() sequentially, outside of the
normal update cycle of HSHG.

@return  void   desc
Updates every object ' s position in the grid but only if the hash value for that object has changed . This method DOES NOT take into account object expansion or contraction just position and does not attempt to change the grid the object is currently in ; it only ( possibly ) changes the cell . If the object has significantly changed in size the best bet is to call removeObject () and addObject () sequentially outside of the normal update cycle of HSHG . @return void desc
function update_RECOMPUTE() {
    var i,
        obj,
        grid,
        meta,
        objAABB,
        newObjHash;
    for (i = 0; i < this._globalObjects.length; i++) {
        obj = this._globalObjects[i];
        meta = obj.HSHG;
        grid = meta.grid;
        objAABB = obj.getAABB();
        newObjHash = grid.toHash(objAABB.min[0], objAABB.min[1]);
        if (newObjHash !== meta.hash) {
            grid.removeObject(obj);
            grid.addObject(obj, newObjHash);
        }
    }
}
function update_RECOMPUTE ( ) { var i , obj , grid , meta , objAABB , newObjHash ; for ( i = 0 ; i < this . _globalObjects . length ; i ++ ) { obj = this . _globalObjects [ i ] ; meta = obj . HSHG ; grid = meta . grid ; objAABB = obj . getAABB ( ) ; newObjHash = grid . toHash ( objAABB . min [ 0 ] , objAABB . min [ 1 ] ) ; if ( newObjHash !== meta . hash ) { grid . removeObject ( obj ) ; grid . addObject ( obj , newObjHash ) ; } } }
Updates every object's position in the grid, but only if
 the hash value for that object has changed.
Updates every object ' s position in the grid but only if the hash value for that object has changed .
// for each object // recompute hash // grid position has changed, update!