Finding the intersection line between two planes is basic linear algebra but is it possible to find one formula, without having to dealing with different cases? Example:
$$ \left\{ \begin{aligned} n_{1x}x + n_{1y}y + n_{1z}z & = d_1\\ n_{2x}x + n_{2y}y + n_{2z}z & = d_2\\ \end{aligned} \right. $$ Divide the first equation by $n_{1x}$, but if $\vec{n_1}\cdot\vec{\hat{x}}=0$ I must reduce another component instead. Continuing $$ \left\{ \begin{aligned} n_{1x}x + n_{1y}y + n_{1z}z & =d_1\\ \left(n_{2y}n_{1x} - n_{2x} n_{1y}\right)y + \left(n_{2z}n_{1x} - n_{2x} n_{1z}\right)z & =n_{1x}d_2-n_{2x}d_1\\ \end{aligned} \right. $$ Now I can find an expression for $z$ in terms of $y$ or vice versa, but I have to check which has the largest coefficient. So will I end up with 6 different expressions depending on which assumptions I did at the beginning.
I want to use the intersection line to see if two triangles intersect, so there is one more test to be done (test if the line is in allowed parameter range), which also appears to have at least two cases. I cannot test for equality since the numbers are floating point numbers.