General formula for collision impulse