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}$.



Conjecture regarding closest point inside a discrete ball to a line
This is true and I would be grateful if someone could make a figure to the argument below.
Your conjecture follows from the following statement.


Let $\ell$ pass through the origin, $O$.
For simplicity, suppose $\ell$ has a positive slope and let $P=(n,m)$ for some $m,n>0$ such that $P$ lies under $\ell$.
Denote by $Q$ the point on $\ell$ whose $y$ coordinate is $m$
and by $R$ the point on the $x$-axis such that $ORPQ$ forms a parallelogram.
Using symmetry, we get that if $OPQ$ is an empty triangle, then so if $ORP$.


Thus if $P$ minimizes the angle, there can be no closer points to the line in the lower part of the same quadrant.
Notice also that all points in the quadrants that are not intersected by $\ell$ are farther than $P$.


