For a ray from the origin with a given angle in $R^n$, I am trying to find the radius at which that ray intersects the frontier of the unit n-cube. In two dimensions, the picture is this:
Given $\theta$, find the distance r to the edge of the unit square. Or, in $n$ dimensions, given angles $\theta_1,...,\theta_{n-1}$, find the distance $r$ to the edge of the unit hypercube.
If somebody could provide a good source of information on doing trigonometry in arbitrary dimensions, that may be enough. As it is I don't know how to approach this problem.