Algorithm to find two points furthest away from each other
Assuming the map is rectangular, you can loop over all border points, and start a flood fill to find the most distant point from the starting point: bestSolution = { start: (0,0), end: (0,0), distance: 0 }; for each point p on the border flood-fill all points in the map to find the most distant … Read more