public void resolveCollision(Sprite collidee)
    {
        // The normal is a unit vector along the line between the sprites.
        Vector2d normal = collidee.getPosition().minus(getPosition());
        normal.setMagnitude(1);

        Vector2d relativeVelocity = collidee.getVelocity().minus(getVelocity());

        double velocityAlongNormal = normal.dotProduct(relativeVelocity);

        // Only bounce if they're moving towards each other.
        if (velocityAlongNormal < 0)
        {
            double impulseMagnitude = (velocityAlongNormal * (1 + collidee
                    .getReboundCoefficient()))
                    / (getInverseMass() + collidee.getInverseMass());

            Vector2d impulse = normal.times(impulseMagnitude);
            applyImpulse(impulse);
            collidee.applyImpulse(impulse.times(-1));
        }
    }