API Docs for: 0.7.1
Show:

```var vec2 = require('../math/vec2');
var Body = require('../objects/Body');

/**
* Base class for broadphase implementations.
* @constructor
*/

this.type = type;

/**
* The resulting overlapping pairs. Will be filled with results during .getCollisionPairs().
* @property result
* @type {Array}
*/
this.result = [];

/**
* The world to search for collision pairs in. To change it, use .setWorld()
* @property world
* @type {World}
*/
this.world = null;

/**
* The bounding volume type to use in the broadphase algorithms. Should be set to Broadphase.AABB or Broadphase.BOUNDING_CIRCLE.
* @property {Number} boundingVolumeType
*/
}

/**
* Axis aligned bounding box type.
* @static
* @property {Number} AABB
*/

/**
* Bounding circle type.
* @static
* @property {Number} BOUNDING_CIRCLE
*/

/**
* Set the world that we are searching for collision pairs in.
* @method setWorld
* @param  {World} world
*/
this.world = world;
};

/**
* Get all potential intersecting body pairs.
* @method getCollisionPairs
* @param  {World} world The world to search in.
* @return {Array} An array of the bodies, ordered in pairs. Example: A result of [a,b,c,d] means that the potential pairs are: (a,b), (c,d).
*/

var dist = vec2.create();

/**
* Check whether the bounding radius of two bodies overlap.
* @param  {Body} bodyA
* @param  {Body} bodyB
* @return {Boolean}
*/
vec2.sub(dist, bodyA.position, bodyB.position);
var d2 = vec2.squaredLength(dist),
return d2 <= r*r;
};

/**
* Check whether the bounding radius of two bodies overlap.
* @param  {Body} bodyA
* @param  {Body} bodyB
* @return {Boolean}
*/
return bodyA.getAABB().overlaps(bodyB.getAABB());
};

/**
* Check whether the bounding radius of two bodies overlap.
* @param  {Body} bodyA
* @param  {Body} bodyB
* @return {Boolean}
*/
var result;

switch(this.boundingVolumeType){
break;
break;
default:
throw new Error('Bounding volume type not recognized: '+this.boundingVolumeType);
}
return result;
};

/**
* Check whether two bodies are allowed to collide at all.
* @method  canCollide
* @param  {Body} bodyA
* @param  {Body} bodyB
* @return {Boolean}
*/
var KINEMATIC = Body.KINEMATIC;
var STATIC = Body.STATIC;

// Cannot collide static bodies
if(bodyA.type === STATIC && bodyB.type === STATIC){
return false;
}

// Cannot collide static vs kinematic bodies
if( (bodyA.type === KINEMATIC && bodyB.type === STATIC) ||
(bodyA.type === STATIC    && bodyB.type === KINEMATIC)){
return false;
}

// Cannot collide kinematic vs kinematic
if(bodyA.type === KINEMATIC && bodyB.type === KINEMATIC){
return false;
}

// Cannot collide both sleeping bodies
if(bodyA.sleepState === Body.SLEEPING && bodyB.sleepState === Body.SLEEPING){
return false;
}

// Cannot collide if one is static and the other is sleeping
if( (bodyA.sleepState === Body.SLEEPING && bodyB.type === STATIC) ||
(bodyB.sleepState === Body.SLEEPING && bodyA.type === STATIC)){
return false;
}

return true;
};