In MATLAB, I have an XY plane that is represented by finite number of points. The possible values of x are stored in a vector X and the possible values of y are stored in an
lets say A = [Xcenter Ycenter]
for K-hop, you can access points:
pointsX = [];
pointsY = [];
for i=-k:k
pointsX = [pointsX Xcenter+i];
pointsY = [pointsY Ycenter+i];
end
Furthermore, you can filter these points by order coordinates and remove the outliers. e.g. consider
(1,1) (1,2) (1,3)
(2,1) (2,2) (2,3)
(3,1) (3,2) (3,3)
Now you know that minimum allowed X and Y are 1, so just filter out points with any ordinate and/or abscissa lesser than that.