collision reaction


      var vxTotal:Number = vel0.x - vel1.x;
      vel0.x = ((ball0.mass - ball1.mass) * vel0.x + 
                2 * ball1.mass * vel1.x) / 
                (ball0.mass + ball1.mass);
      vel1.x = vxTotal + vel0.x;
  
      // update position
      pos0.x += vel0.x;
      pos1.x += vel1.x;
      
      // rotate positions back
      var pos0F:Object = rotate(pos0.x,
              pos0.y,
              sin,
              cos,
              false);
              
      var pos1F:Object = rotate(pos1.x,
              pos1.y,
              sin,
              cos,
              false);
  
      // adjust positions to actual screen positions
      ball1.x = ball0.x + pos1F.x;
      ball1.y = ball0.y + pos1F.y;
      ball0.x = ball0.x + pos0F.x;
      ball0.y = ball0.y + pos0F.y;