I have been given a lattice convex polygon. All I want to do is iterate through all vertices and grab the interior points near it (if possible) and only in 4 directions and of unit distance from the point.How do I do that?
Brief of what I did,
I iterate through all vertices. I take a vertex calculate slope between current vertex and the next and
if
the slope is positive and Y-coord is increasing I print the (curX-1,curY).
else
I print (curX+1,curY)
Similarly for slope being negative.
I leave the the cases where the slope is INF or 0.And also the cases where the previous slope was INF or 0. (optional,better methods would consider this too)
Any other better method?Is my algorithm correct? (curX=current X,curY=current Y)
Assume that the vertices are given in CCW.