Well, if c is the distance between the objects, a is what you measured to object 1, b is what you measured to object 2, and the angle that the servo had to turn to get from object a to object b is T, then the law of cosines says that:
c^2 = a^2 + b^2 + 2*a*b*cos(T)
It's sort of a generalization of Pythagorean Theorem, but it works when the triangle isn't a right angled triangle. You put your stuff into that equation and take the square root and that is the distance between the objects. Was that what you were looking for?