## request for proof review: minimum angle to point in a line segment

Hi,

Not sure if maybe this belongs in the geometry forum, but I'm using the methods of linear algebra, so here it is.

Anyway, I have a problem I need to solve for a piece of software I'm writing, and I think I've got it but it would be great if somebody could take a quick look at this proof and see if I've overlooked anything. Thanks in advance.

Here is the problem: We're working in $R_3$ here. Given a line segment $L$ defined by endpoints $\vec{r}$ and $\vec{s}$, and a unit vector $\vec{u}$, what is the minimum angle $\theta$ between $\vec{u}$ and any point on the line segment? We can assume the segment does not pass through the origin.

And here's what I came up with: If the line defined by $\vec{r}$ and $\vec{s}$ passes through the origin (outside the segment), all angles will be the same and clearly $\theta$ = the angle between $\vec{u}$ and $\vec{r}$ (or $\vec{s}$). Otherwise $\vec{r}$, $\vec{s}$ and the origin define a plane $P$. We can reduce the problem to a two dimensional analysis as follows. Let $\vec{v}$ be the projection of $\vec{u}$ into $P$. If $\vec{v}$ is zero, then all the vectors in $L$ will be orthogonal to $\vec{u}$, and so $\theta = \pi/2$.

For nonzero $\vec{v}$, check if $\vec{v}$ lies between $\vec{r}$ and $\vec{s}$. That is, if $\angle rv$ and $\angle sv$ are both $\le \angle rs$. If so, then there exists a vector to some point in $L$ that is just a scalar multiple of $\vec{v}$, so $\theta$ is simply the minimum angle between $\vec{u}$ and $P$, i.e. $\angle uv$ (which will be less than $\pi / 2$). Similarly, if $-\vec{v}$ lies between $\vec{r}$ and $\vec{s}$, then $\theta$ is the angle between $\vec{u}$ and $-\vec{v}$.

If $\pm v$ lie outside of the angle between $\vec{r}$ and $\vec{s}$, then the angle with $\vec{u}$ will be monotonic while traversing the line segment (this is correct, right?). Therefore the minimum angle will occur at one of the endpoints, and so $\theta$ is the minimum of $\angle ur$ and $\angle us$ (which could be greater than $\pi / 2$).

Where I have written $\angle xy$ I will be calculating according to the usual formula $cos^{-1}(\vec{x} \cdot \vec{y} / |x| |y|)$. I'm interested in the direction of $\vec{u}$ but not its length, which is why I specified a unit vector.

Okay, if you're still with me and have any thoughts for me, thank you!!

-Kyle