Find a tile
Find the left top row candidate
while( left_top_row <= bottom_row && remaining_vertices > 0)
edge_start = left_edge_end;
Be careful with C % operator, (N-1) % M will give -1 for N = 0, need to use (N+M-1) % M to get (N-1) mod M = N-1
left_edge_end = (left_edge_end+num_vertices-1)%num_vertices;
left_top_row = ceil(v[left_edge_end].y);
We found the first edge that sticks out over bottom_row
determine the slope and starting x location for the left tile edge.
if(left_top_row > bottom_row )
left_step = (v[left_edge_end].x - v[edge_start].x)/
(v[left_edge_end].y - v[edge_start].y);
left_pos = v[edge_start].x +
(bottom_row-v[edge_start].y)*left_step;