Use Pythagoras’ theorem in 3D.