# Intersection between a line and a n dimensional parallelotope

Suppose that I have a line in an $$n$$ dimensional space described by $$X=A+Bk, \quad \quad X,A,B \in \mathbb{R}^n, k \in \mathbb{R}$$ here $$A$$ is known and I want to find all the possible vectors $$B$$ such that this line has one and only one intersection with the set $$S$$ described by: $$S=\{ X \in \mathbb{R}^n \: | \: 0 \le X \le W\}$$ where $$W \in \mathbb{R}_+^n$$ and the inequalities are to be intended component-wise.

Is there any closed-form formula for such vectors $$B$$?

• Yes but since I want to find all vectors $B$ such that there is just one intersection, that can happen if and only if the line passes through either a vertex or an edge of my parallelotope, isn't that right? – Leonardo Massai Jan 22 at 15:37