On the evaluation of the gravity effects of polyhedral bodies and a consistent treatment of related singularities