Path optimization using the Douglas-Peucker Line Approximation Algorithm in Objective C