I have a small geometric problem and I am searching for a exact solution. As its a geometric problem I think its best ilustrated as a picture.

I have given A, B, C, D and P. These are on a 2D coordinate system with float accuracy. I want to find a line, that intersects both lines at the same ratio and goes through point P. ultimately I want calculate the ratio that is marked in blue in the description picture and I want to be exact. I could only find approximations so far. I starting to think, that there isnt even a exact solution to this problem...
I hope I described my problem as exact as possible and there is a math genius out there that can help me. I am just a stupid programmer ;-(
Kind regards, Dominik
Suppose we call the unknown ratio (that is, $30\%$ in your diagram) $t$. Then we have these expressions for $L$ and $K$:
$$ L = \begin{pmatrix} x_A+t(x_B-x_A) \\ y_A+t(y_B-y_A) \end{pmatrix} \qquad K = \begin{pmatrix} x_C+t(x_D-x_C) \\ y_C+t(y_D-y_C) \end{pmatrix} $$
and these expressions for the vectors $\vec{PL}$ and $\vec{PK}$:
$$ \tag{1} \vec{PL} = \begin{pmatrix} x_A+t(x_B-x_A)-x_P \\ y_A+t(y_B-y_A) -y_P \end{pmatrix} \qquad \vec{PK} = \begin{pmatrix} x_C+t(x_D-x_C)-x_P \\ y_C+t(y_D-y_C)-y_P \end{pmatrix} $$
We want to find $t$ such that $\vec{PL}$ and $\vec{PK}$ are parallel. There is a nifty condition for 2D vectors being parallel, namely that we must have $$ \tag{2} x_{PL}\cdot y_{PK} = x_{PK}\cdot y_{PL} $$ If you insert the coordinates of $\vec{PL}$ and $\vec{PK}$ from (1) into (2), it simplifies into a quadratic equation in $t$, which you can solve using the quadratic formula. In general there may be either zero, one, or two solutions in the interval between $0$ and $1$. (Or in some degenerate cases, every $t$ may work, such as for $A(0,2), B(2,2), C(2,0), D(0,0), P(1,1)$).
Can you handle the algebra yourself from here?