Delphi coordinate conversion inspired by http://www.movable-type.co.uk/