Answer the question
In order to leave comments, you need to log in
How to find the nearest points on the coordinate plane?
There is a coordinate plane 10 by 10. Points are randomly located on it. Their coordinates can be: (1, 3); (4, 2) etc. Let's say there is a point with coordinates (4, 5). How to find the closest 3 points to it?
Answer the question
In order to leave comments, you need to log in
Are the coordinates strictly integer?
Then bypass the points using the floodfill algorithm, centered on the starting point.
For example, for a small area, the order would be:
5 4 3 4 5
4 2 1 2 4
3 1 X 1 3
4 2 1 2 4
5 4 3 4 5
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question