A frictionless contact algorithm for deformable bodies