Direct inversion of potential fields from an uneven track with application to the Mid-Atlantic Ridge