Let $S$ be a nonempty subset of $\mathbb{R}^2$ and $l$ a line in $\mathbb{R}^2$ disjoint from $S$. Then $l$ partitions $S$ into two disjoint sets $S = S_1 \cup S_2$ in the obvious way. Note that, at least when $1 < |S| < \infty$, there are many lines that determine the same partition of $S$ as $l$ does.

Now let $m,n$ be positive integers and consider the case $S = \{0,1,2,\ldots,m\} \times \{0,1,2,\ldots,n\} \subset \mathbb{N}^2 \subset \mathbb{R}^2$.

Question 1: Given (the equations) of two lines how can I efficiently (i.e. without explicitly checking all the points in $S$) determine if these lines determine the same partition of $S$?

Question 2: How can I enumerate all such "line partitions" of $S$? Ideally, I should be able to efficiently determine the rank of an arbitrary line in this enumeration.