build/physics/physics.js
function(p1, p2, r1, r2)
{
    var mindist = r1 + r2;
    var delta = vsub(p2, p1);
    var distsq = vlengthsq(delta);
    if(distsq >= mindist*mindist) return;
    
    var dist = Math.sqrt(distsq);

    // Allocate and initialize the contact.
    return new Contact(
        vadd(p1, vmult(delta, 0.5 + (r1 - 0.5*mindist)/(dist ? dist : Infinity))),
        (dist ? vmult(delta, 1/dist) : new Vect(1, 0)),
        dist - mindist,
        0
    );
}
function(p1, p2, r1, r2)
{
    var mindist = r1 + r2;
    var delta = vsub(p2, p1);
    var distsq = vlengthsq(delta);
    if(distsq >= mindist*mindist) return;
    
    var dist = Math.sqrt(distsq);

    // Allocate and initialize the contact.
    return new Contact(
        vadd(p1, vmult(delta, 0.5 + (r1 - 0.5*mindist)/(dist ? dist : Infinity))),
        (dist ? vmult(delta, 1/dist) : new Vect(1, 0)),
        dist - mindist,
        0
    );
}
function ( p1 , p2 , r1 , r2 ) { var mindist = r1 + r2 ; var delta = vsub ( p2 , p1 ) ; var distsq = vlengthsq ( delta ) ; if ( distsq >= mindist * mindist ) return ; var dist = Math . sqrt ( distsq ) ; // Allocate and initialize the contact. return new Contact ( vadd ( p1 , vmult ( delta , 0.5 + ( r1 - 0.5 * mindist ) / ( dist ? dist : Infinity ) ) ) , ( dist ? vmult ( delta , 1 / dist ) : new Vect ( 1 , 0 ) ) , dist - mindist , 0 ) ; }
Add contact points for circle to circle collisions. Used by several collision tests.
Add contact points for circle to circle collisions . Used by several collision tests .