Thanks for your reply and help. I am sorry that I may not describe the problem clearly. In fact, the “m” and “n” in my problem are the most important ones. I want to find the coordinates of the top N points surrounding the P, that is the range of (x-m, y-n) to (x+m,y+n), neither from the whole region of Q.