TITLE: Conjecture regarding closest point inside a discrete ball to a line
QUESTION [13 upvotes]: I'm a PhD student in image processing, where I've stumbled into a problem that seems to be essentially number theory.  I've hunted around online and while I've found many results on similar problems, this particular problem I cannot seem to find a solution to:
Given a line in the plane passing through the origin making angle $\theta$ with the $x$-axis, I am trying to determine the closest nonzero Gaussian integer $n+im$ to the line obeying $|n+im| \le r$.
I have a conjecture which is backed up by numerous computer tests, but no proof.  The conjecture is as follows:  
Let $\Theta(r) = \{\theta_1,\theta_2,...,\theta_N\}$ denote the set of angles representable using Gaussian integers of this form.  That is, each $\theta_k=Arg(n+im)$ for some non-zero Gaussian integer $n+im$ of norm at most $r$.
Find $\theta_k, \theta_{k+1}$ straddling $\theta$, i.e. $\theta_k \le \theta < \theta_{k+1}$.  Let $n+im$ be a Gaussian integer that solves our minimization problem.  Then either $Arg(n+im)=\theta_k$ or $Arg(n+im)=\theta_{k+1}$.

REPLY [2 votes]: I think the proof of @domotrop is not complete.
I will first present my own proof.  After several revisions, it is now complete.  Then I will express my concern for the proof of @domotrop, and propose a fix.
In the following picture, $O$ is the origin.  Let $P$ and $Q$ be the closest points with angle $\theta_k$ and $\theta_{k+1}$. The point $-Q$ is the opposite of $Q$.  Without loss of generality, we assume that $P$ is closer to $\ell$ than $Q$.
Up to a change of sign, any closer lattice point with larger angle from $\ell$ will be in the grey area, for example the blue point.  Then with the help of a parallelogram, we can find the red lattice point in either of the green areas with smaller angle from $\ell$.  This red point is definitely inside the circle, so it contradicts our assumption.

I think the proof of @domotrop is not complete.  My concern for @domotrop's proof was the following: For example, in the picture of @Rob, $P$ minimize the angle with $\ell$ from below, but the point $(-1,-1)$ is closer with a larger angle from $\ell$.  Therefore, if $\arg(n+im)$ takes value in $(-\pi,\pi]$, the points like $(-1,-1)$, which are in the lower half-space, is something that we should be careful with.  That is, either there is no such point, or the opposite of the closest is indeed the next angle.
The fix consists of considering the opposite of the $\theta_{k+1}$ as in my proof.  Then, in the above picture, since the green parts are empty, so is the grey part, and Q.E.D.  @domotrop explained that we only needs to consider the two quadrants containing $\ell$.  Then his proof is complete after repeating the same argument above $\ell$ in the first quadrant, and replacing $y$ with $x$ when constructing the parallelogram.