The simplest way is to just measure the actual distance. That should usually give pretty reliable results. But otherwise, it can become difficult because outside of going for a simple Pythagoras, you get wonky systems where you add the height or things like that.