Checking if vector crosses the simplex Let assume that I have a point in $x \in \mathbb{R}^n$
Also I have a non-zero vector defined by it's endpoint attached to this point.
The third thing I have is a simplex of $\dim=n$, such that the point $x$ is one of it's vertices.
I need to know if this vector crosses the interior of the simplex, that is if a ray generated by this vector and point $x$ crosses the face of the simplex that lays on the other side of the vertex $x$
I know that you can probably do some magic by computing some determinants, but I can't find any reference to guide me how it can be done
 A: Let me denote $\vec{x}^{\,(1)}$, $\dots$, $\vec{x}^{\,(n+1)}$ vertices of the simplex. Without loss of generality I assume we "sit" at $\vec{x}^{\,(1)}$ and direction of our view is $\vec{v}$. There is a two-step process to determine wether we look inside the simplex or not. First of all you should calculate parameter
$$
t = (-1) \frac{
    \det
    \begin{pmatrix}
        \begin{matrix}
            x_{1}^{(1)} \\
            x_{2}^{(1)} \\
            \cdots      \\
            x_{n}^{(1)} \\
        \end{matrix} &
%
        \begin{matrix}
            x_{1}^{(2)} \\
            x_{2}^{(2)} \\
            \cdots      \\
            x_{n}^{(2)} \\
        \end{matrix} &
%
        \cdots &
%
        \begin{matrix}
            \! x_{1}^{(n+1)}\! \\
            \!x_{2}^{(n+1)}\! \\
            \!\cdots \!       \\
           \! x_{n}^{(n+1)} \!\\
        \end{matrix} \\
%
        1 & 1 & \cdots & 1
    \end{pmatrix}
}{
    \det
    \begin{pmatrix}
        \begin{matrix}
            v_{1} \\
            v_{2} \\
            \cdots      \\
            v_{n} \\
        \end{matrix} &
%
        \begin{matrix}
            x_{1}^{(2)} \\
            x_{2}^{(2)} \\
            \cdots      \\
            x_{n}^{(2)} \\
        \end{matrix} &
%
        \cdots &
%
        \begin{matrix}
            \! x_{1}^{(n+1)}\! \\
            \!x_{2}^{(n+1)}\! \\
            \!\cdots \!       \\
           \! x_{n}^{(n+1)} \!\\
        \end{matrix} \\
%
        0 & 1 & \cdots & 1
    \end{pmatrix}
}.
$$
If $t \leq 0$ -- no chances you are looking inside the simplex. Otherwise additional consideration is needed. It is performed as follows. First you calculate the point, where our "line of view" intersects the simplex (if it does)
$$
    \vec{x} = t \vec{v} + \vec{x}^{(1)}.
$$
This is the only possible point to intersect the face of the simplex on the other side of $\vec{x}^{(1)}$. You only need to find its barycentric coordinates and check they all are between zero and one. This can be performed with following formula
$$
\vec{\Lambda} =
(-1)
\frac{
    \det
    \begin{pmatrix}
        0 & \vec{e}_{1} & \vec{e}_{2} & \dots & \vec{e}_{n+1} \\
        \begin{matrix}
            x_{1} \vphantom{x_{1}^{(1)}} \\
            x_{2} \vphantom{x_{1}^{(1)}} \\
            \cdots                       \\
            x_{n} \vphantom{x_{1}^{(1)}} \\
        \end{matrix} &
%
        \begin{matrix}
            x_{1}^{(1)}  \\
            x_{2}^{(1)}  \\
            \cdots       \\
            x_{n}^{(1)}  \\
        \end{matrix} &
%
        \begin{matrix}
            x_{1}^{(2)}  \\
            x_{2}^{(2)}  \\
            \cdots       \\
            x_{n}^{(2)}  \\
        \end{matrix} &
%
        \cdots &
%
        \begin{matrix}
            \!x_{1}^{(n+1)}\! \\
            \!x_{2}^{(n+1)}\! \\
            \cdots        \\
            \!x_{n}^{(n+1)}\! \\
        \end{matrix} \\
%
        1 & 1 & 1 & \cdots & 1
    \end{pmatrix}
}{
    \det
    \begin{pmatrix}
        \begin{matrix}
            x_{1}^{(1)} \\
            x_{2}^{(1)} \\
            \cdots      \\
            x_{n}^{(1)} \\
        \end{matrix} &
%
        \begin{matrix}
            x_{1}^{(2)} \\
            x_{2}^{(2)} \\
            \cdots      \\
            x_{n}^{(2)} \\
        \end{matrix} &
%
        \cdots &
%
        \begin{matrix}
            \! x_{1}^{(n+1)}\! \\
            \!x_{2}^{(n+1)}\! \\
            \!\cdots \!       \\
           \! x_{n}^{(n+1)} \!\\
        \end{matrix} \\
%
        1 & 1 & \cdots & 1
    \end{pmatrix}
}.
$$
Here $\vec{e}_{1}$, $\dots$, $\vec{e}_{n+1}$ are some formal orthonormal vectors.
As a result you get a "vector" $\vec{\Lambda}$, which components are barycentric coordinates of the point $\vec{x}$.
Now the easy part: check that $\Lambda_1 = 0$ and each component $0 < \Lambda_{i>1} < 1$ and you may state that the point $\vec{x}$ is on the face of the simplex you are interested in, otherwise there are no such points.
EXAMPLE
Say the simplex is triangle with coordinates $(0;0)$, $(0;1)$, and $(1;0)$. We "sit" at $(0;0)$ and look toward $(1;1)$. Do we look inside the triangle?
$$
t = (-1) \frac{
    \det
    \begin{pmatrix}
    0 & 0 & 1 \\
    0 & 1 & 0 \\
    1 & 1 & 1
    \end{pmatrix}
}{
    \det
    \begin{pmatrix}
    1 & 0 & 1 \\
    1 & 1 & 0 \\
    0 & 1 & 1
    \end{pmatrix}
} = \frac{1}{2}.
$$
Since $t > 0$ there is a chance we look inside, but we cannot tell definitely. Let's find the only possible point of intersection with the face of interest
$$
\vec{x} = \frac{1}{2} \begin{pmatrix} 1\\ 1 \end{pmatrix} 
        + \begin{pmatrix} 0\\ 0 \end{pmatrix}
        = \begin{pmatrix} 1/2 \\ 1/2 \end{pmatrix}.
$$
Let's check its barycentric coordinates
$$
\vec{\Lambda} = (-1) \frac{
    \det
    \begin{pmatrix}
    0   & \vec{e}_1 & \vec{e}_2 & \vec{e}_3 \\
    1/2 & 0 & 0 & 1 \\
    1/2 & 0 & 1 & 0 \\
    1   & 1 & 1 & 1
    \end{pmatrix}
}{
    \det
    \begin{pmatrix}
    0 & 0 & 1 \\
    0 & 1 & 0 \\
    1 & 1 & 1
    \end{pmatrix}
} = 0 \vec{e}_1 + \frac{1}{2} \vec{e}_2 + \frac{1}{2} \vec{e}_3.
$$
The latter says we look inside the simplex.
Correctness of this solution is easy to verify by painting a picture.
WHERE DOES THIS ALL COME FROM
I was basing on theory, recently published in "Workbook on mapping simplexes affinely" and "Beginner's guide to mapping simplexes affinely". If you combine ideas of affine curves mapping and calculation of barycentric coordinates (both presented there) it's easy to write equation of the line in barycentric coordinates. The latter is used to obtain the suspected intersection point.
