## Equation of line in 3D and visualisation using Autograph

### May 8, 2014

A new one on me.

Consider the vector equation of a straight line:

r = a+ λ b applies in 2, 3, (n) dimensions. Such is the power of vector notation.

If you want to convert a general example to its Cartesian equivalent:

$\left( \begin{array}{c} {a_i \, + {\lambda} \, b_i } \\ a_j \, + {\lambda} \, b_j \\ a_k \, + {\lambda} \, b_k \end{array} \right)$

Set each component equal to x, y and z, respectively

x = $a_i \, + {\lambda} \, b_i$
y = $a_j \, + {\lambda} \, b_j$
z = $a_k \, + {\lambda} \, b_k$

then rearrange to get expressions all equal to the parameter, λ

${\dfrac{x - a_i} {b_i} } = {\lambda} \\ {\dfrac{y - a_j} {b_j} } = {\lambda} \\ {\dfrac{z - a_k} {b_k} } = {\lambda} \$

Set them equal:

${\dfrac{x - a_i} {b_i} } = {\dfrac{y - a_j} {b_j} } = {\dfrac{z - a_k} {b_k} } \\$
and one is done.

A specific example

$\left( \begin{array}{c} {2 \, + {\lambda} \, (-1) } \\ 3 \, + {\lambda} \, (1) \\ -1 \, + {\lambda} \, (-2) \end{array} \right)$

Rearranges to :

$\dfrac{x - 2}{ -1} = y - 3 = \dfrac{z + 1}{ -2}$

Let’s plot the straight line graph using Autograph 3D visualisation of the vector form

The “hand” option enables me to pull and rotate the axes around the origin of the axes. So here follow two views of the line from two different viewing positions and the line looks completely different. Notice the position of the axes have shifted.

Vector line – viewing perspective two

Now, here’s the sucker punch for me. If I rotate the image so I am looking “along” each axis in turn, then it is as if that axis has disappeared. So if I look along the z-axis I am only seeing the line relative to the x and y axes, the projection of the line on to the x-y plane.

Projection along z-axis

Projection along y-axis

Projection along x-axis

You can see in each case we have a straight line. The equation of each line is as follows. If we are looking along the z-axis at the projection on to the x-y plane then we take the Cartesian equation and eliminate the term in z:

$\dfrac{x - 2}{ -1} = y - 3$

Similarly, along the y-axis onto the x-z plane, eliminate the term in y:

$\dfrac{x - 2}{ -1} = \dfrac{z + 1}{ -2}$

Finally, along the x-axis onto the y-z plane, eliminate the term in x:

$y - 3 = \dfrac{z + 1}{ -2}$