Improves performances of shore distance calculation