Angle Between Two 3D Lines – Calculation Methods

3dlinear algebra

I know for given 2 vector $\vec{u},\vec{v}$ the angle between them achieved by – $$\cos{\theta} = \frac{\vec{u} \cdot \vec{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}$$

but what if I want to calculate the $\theta$ between two 3D line ?

For example given 2 lines which each of them represented by two 3D points –
$$line1: (3,2,-5)\hspace{5 mm }, (1,1,1) \\ line2: (1,-4,6)\hspace{5 mm }, (1,1,1)$$

How should I caclculate the angle $\theta$ between those 2 lines ?

Best Answer

You can think of the formula as giving the angle between two lines intersecting the origin. So just "move" the intersection of your lines to the origin, and apply the equation.

Shifting lines by $( -1,-1,-1 )$ gives us:

Line $1$ is spanned by the vector $\vec{u} = ( 2,1,-6 )$

Line $2$ is spanned by the vector $\vec{v} = (0,-5,5)$

Now calculating the angle between the lines is a direct application of the equation you gave.

Related Question