Line-line intersection
Given two lines in 3D defined as rays
Where $t_1, t_2 \in \mathbb{R}$, the two lines intersect if
We can apply the cross multiplication operation on both sides with $\mathbf{d_2}$ and work from there to find the value of $t_1$
Similarly we can find the value of $t_2$ by crossing with $\mathbf{d_1}$ and work from there to find the value of $t_2$
The proof can be found here
We can actually solve this problem graphically by using triangle similarity, imagine the following situation
The intersection point $\mathbf{p}$ is equal to
By triangle similarity we see that
Multiplying the left side with an identity
We see that the quantity $\norm{ \mathbf{ n - a } } \norm{\mathbf{d - c}}$ is equal to the equation of the area of a parallelogram, we can skew the parallelogram (in the graphic towards the $x$-axis) so that the left side becomes $\mathbf{c - a}$ and the bottom side $\mathbf{d - c}$ (which is not affected by the skew), note that the area can also be expressed with the cross product of the vectors $\mathbf{c - a}$ and $\mathbf{d - c}$ therefore
A similar equation can be derived for the parallelogram with sides $\mathbf{m - a}$ and $\mathbf{d - c}$, only this time the skewed side will become $\mathbf{b - a}$
Replacing \eqref{numerator-area}, \eqref{denominator-area} in \eqref{line-line-triangle-similarity} and \eqref{line-line-intersection-point} we see that the intersection point is equal to
References
- Intersection between two segments. [online] Stackoverflow.com. Available at: http://stackoverflow.com/a/565282/3341726 [Accessed 10 Mar. 2016].
- Palacios, R. (2012). Geometria Computacional. (presentation given at the UCB for the ICPC 2012)
- Lee, J. (2008). Similar triangles [online] Math.washington.edu. Available at: https://www.math.washington.edu/~lee/Courses/444-5-2008/supplement3.pdf [Accessed 10 Mar. 2016].