calculate the object and image distance.