Plane - Line Intersection

Purpose is to find the point 'e' were the line defined by point 'f' and 'g' intersects with the plane defined by the points 'a', 'b', 'd'.

The plane can be described with:

$\displaystyle s = \vec{a} + c_1 * \vec{ab} + c_2 * \vec{ad}$ (1)

the line can be described with:
$\displaystyle k = \vec{f} + c_3 * \vec{fg}$ (2)

the intersection is defined by
$\displaystyle s = k,$ (3)

therefore follows (sorry here is a mistake, S has to be what f+c3*fg, I will correct this soon):
$\displaystyle S = \vec{a} + c_1 \cdot \vec{ab} + c_2 * \vec{ad}$ (4)

This results in the following matrice vector produkt: 
$\displaystyle \begin{bmatrix} b_x - a_x & d_x - a_x & g_x -f_x \\  b_y - a_y ...
... = \begin{bmatrix} f_x - a_x \\  f_y - a_y \\  f_z - a_z \\  \end{bmatrix}$ (5)

This can be solved for instance for $ c_3$.

The coordinates of the point $ e$ we are looking for are:

$\displaystyle \vec{e} = \vec{f} + c_3 * \vec{fg} = \vec{d} * \vec{e} = \begin{...
...\cdot \begin{bmatrix} g_x - f_x\\  g_y - f_y\\  g_z - f_z\\  \end{bmatrix}$ (6)

This linear equation could be solved either directly (gauss-elimination) or with the help of an equation solver which I have done (sorry).

I use the lapack routine dgesvx.

c o m p i l i n g:

With the intel fortran compiler on linux and properly installed lapack a command like:

$ ifort\: -o\: plints.x\: -llapack\: -lblas\: -lg2c\: -fi\: plintsc.f90\: callplis.f90$
should work.

The algorithm is based on the calculations of A. Wolf. However, I am the one to blame for any error!

Here is a Fortran version of this algorithm. Given the time, I will also write a Java version. And maybe some day I will solve the Gauss-Elimination ;-)