Integrated functions distanceFromMidPoint and GetNearestHex from Ian (disqus user: boingy)