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 $\displaystyle R_3$ here. Given a line segment $\displaystyle L$ defined by endpoints $\displaystyle \vec{r}$ and $\displaystyle \vec{s}$, and a unit vector $\displaystyle \vec{u}$, what is the minimum angle $\displaystyle \theta$ between $\displaystyle \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 $\displaystyle \vec{r}$ and $\displaystyle \vec{s}$ passes through the origin (outside the segment), all angles will be the same and clearly $\displaystyle \theta$ = the angle between $\displaystyle \vec{u}$ and $\displaystyle \vec{r}$ (or $\displaystyle \vec{s}$). Otherwise $\displaystyle \vec{r}$, $\displaystyle \vec{s}$ and the origin define a plane $\displaystyle P$. We can reduce the problem to a two dimensional analysis as follows. Let $\displaystyle \vec{v}$ be the projection of $\displaystyle \vec{u}$ into $\displaystyle P$. If $\displaystyle \vec{v}$ is zero, then all the vectors in $\displaystyle L$ will be orthogonal to $\displaystyle \vec{u}$, and so $\displaystyle \theta = \pi/2$.

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

If $\displaystyle \pm v$ lie outside of the angle between $\displaystyle \vec{r}$ and $\displaystyle \vec{s}$, then the angle with $\displaystyle \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 $\displaystyle \theta$ is the minimum of $\displaystyle \angle ur$ and $\displaystyle \angle us$ (which could be greater than $\displaystyle \pi / 2$).

Where I have written $\displaystyle \angle xy$ I will be calculating according to the usual formula $\displaystyle cos^{-1}(\vec{x} \cdot \vec{y} / |x| |y|)$. I'm interested in the direction of $\displaystyle \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