Say we have a space of dimension $D$. Say we have a $D$-cube of side $l$ centered at the origin and inside it we have a point $P\in \mathbb{R}^D$ and a collection of $D-1$ angles $\phi_1, \phi_2, \ldots \phi_{D-1}$. Then, say we have a line $r$ that is defined by the point $P$ and the angles.
Is there any nice formula to determine the points where the line and the cube will intersect?