How to implement closest point of approach?