☖ Home Units Converter Geometry Σ Math Physics Electricity

Line 3D geometry - calculator

Print midline calculator
Parametric line equation L1
x
 = 
 + t 
y
 = 
 + t 
z
 = 
 + t 
General line equation L1
 x
+
=
 y
+
=
 z
+
Line defined
by 2 points P1, P2
L1
x1
 
   y1
 
   z1
 
x2
 
   y2
 
   z2
 
If   t = The equivalent point on the line is:
If   t = The equivalent point on the line is:
Distance from
P1 to P2
Distance of L1 from the origin
Line spherical angles
Direction angles
Direction cosines
3D lines summary Direction angles Distance between two 3D lines Presentation of 3D lines
Example 1 Example 2 Example 3 Example 4

3D lines summary

Print 3D lines summary

Distance between two 3D points: (x0 , y0 , z0) and (x1 , y1 , z1)

d=√((x_1-x_0 )^2+(y_1-y_0 )^2+(z_1-z_0 )^2 )

Line passing through two points (x0 , y0 , z0) and (x1 , y1 , z1)

A point P(x, y, z) is on the line L if and only if the direction numbers determined by P0 and P1 are proportional to those determined by P1 and P2. If the proportionality constant is t we see that the conditions are:
x-x_0=t(x_1-x_0 ), y-y_0=t(y_1-y_0 ), z-z_0=t(z_1-z_0 )
The two points of the parametric equation of a line are:
x=x_0+(x_1-x_0 )t y=y_0+(y_1-y_0 )t z=z_0+(x_1-x_0 )t
(1)
The parametric equations of line L through the point with direction numbers a, b and c are given by the equations:
x=x_0+at y=y_0+bt z=z_0+ct
(2)
Two points formed by the equation of a line also may be written symmetrically as:
(x-x_0)/(x_1-x_0 )=(y-y_0)/(y_1-y_0 )=(z-z_0)/(z_1-z_0 )=t

Two lines with slopes (a1, b1, c1) and (a2, b2, c2) are perpendicular to each other if and only if:

Two lines are parallel if:

Direction angles, direction cosines and direction numbers

Print direction numbers

A line presented by a vector, produces angles respective to the x, y and z axis, these angles are known as direction angles and are presented by the letters α, β and γ

If the projection of the line presented by a vector as L: xi + yj + zk (i, j and k are denoting the vector directions in x, y and z direction). The magnitude of the line is also known as modulus of the vector is:

‖d‖=√(x^2+y^2+z^2 )

According to the vector calculus the division of the projection length on each axis divided by the magnitude of the vector produces the cosine of the angle from the vector to the axis.

cos⁡α=x/‖d‖ cos⁡β=y/‖d‖ cos⁡γ=z/‖d‖

These values of the angles are known as the directional cosines.

Notice that the sum of the squares of the directional cosines is equal to 1:

cos^2 α+cos^2 β+cos^2 γ=1

Presentation of 3D lines

Print 3D lines

A 3D line can be presented by several methods, the most frequent way is by parametric equations or by the classical form, another way is by vector notations, the line can also be presented by defining two points along the line.

1.
Parametric equations
x=x_1+a_1 t y=y_1+b_1 t z=z_1+c_1 t
x1 , y1 , z1
A point on the line
a1 , b1 , c1
Direction numbers
2.
The classical equations
(x-x_1)/a_1 =(y-y_1)/b_1 =(z-z_1)/c_1

The parametric and the classic presentation of the line are actually the same, to show this we take the values of the division of x, y and z as equal to t:

(x-x_1)/a_1 =(y-y_1)/b_1 =(z-z_1)/c_1=t
(x-x_1)/a_1 =t  (y-y_1)/b_1 =t  (z-z_1)/c_1 =t
x-x_1=a_1 t  y-y_1=b_1 t  z-z_1=c_1 t
x=x_1+a_1 t  y=y_1+b_1 t  z=z_1+c_1 t

And we receive again the parametric equations of the line, different values of  t  describes different points along the line.

Notice that when a direction number is 0 let say  a1 = 0  the  x  term will be:
(x-x_1)/0

This is incorrect mathematically, but in the line notation it means that  x = x1  and the line; is located on a plane parallel to the  y-z  axis.

If two direction numbers, let say  a1 = b1 = 0 , the line is parallel to the z axis. All 3 direction numbers can not be 0 as there will be no line but only a point.

3.
The vector notation
r ⃗_1=a ⃗_1+b ⃗_1=xi+yj+zk+(v_x i+v_y j+v_z k)

Notice that r1 is a location of a point on the line and e1 (in the parenthesis) defines the direction numbers of the line.

4.
Line defined by 2 points
r ⃗_1=a ⃗_1+b ⃗_1=xi+yj+zk+(v_x i+v_y j+v_z k)

This method includes choosing one point on the line, let say (x1, y1, z1) and then calculating the direction numbers   a1, b1 and c1  of the line  L1:

a_1=x_2-x_1  b_1=y_2-y_1  c_1=z_2-z_1

3D lines - Example 1

Print 3D lines Example 1
Question:
Find (a) the parametric equations of the line passing through the points P1(3, 1, 1) and P2(3, 0, 2). and also find a point on the line that is located at a distance of 2 units from the point (3, 1, 1).
Solution:
a) from equation (1) we obtain the parametric line equations:
Any additional point on this line can be described by changing the value of t for example t = 2 gives the point (3, ⎯ 1, 3) which is located on the line.

b) distance from any point (x, y, z) to the point (3, 1, 1) is:
Replace x, y and z by their parametric values gives:
Substituting the value of t in the parametric line equations yields the required point which can be located on either side of the line:

3D lines - Example 2

Print Example 2
Question:
Find the equation of the line that passes through the point (1, 1, ⎯ 2) and is parallel to the line that connects the points  A(1, 2, 3) and B(2, 0, 4).
Solution:
The direction numbers (values of t) of the given A B line are:
The required line that passes through point (1, 1, ⎯ 2) and has direction numbers a, b and c in parametric notations are:

3D lines - Example 3

Print Example 3
Question:
A line L is given by the parametric equations   x = 1 + t   y = 4t   z = 2 + 2t,   find the length of the line from the point with values of  t = -1  to the point were  t = 2. Also find the angles between the line and the axis x, y and z.
Solution:
We get the two points on the line by substituting the values t = −1 and t = 2. The direction numbers (values of t) of the given A B line are:
P1 (0 , -4 , 0)       and       P2 (3 , 8 , 6)

The length of the line is the distance between the two 3D points:

d=√((3-0)^2+[8-(-4)]^2+(6-0)^2 )=√189=13.75

To find the cosine of the angles between the line and the axis, we divide each axis length with the total length of the line  d.

cos⁡α=x/d=(3-0)/13.75=0.22

cos⁡β=y/d=(8-(-4))/13.75=0.87

cos⁡γ=z/d=(6-0)/13.75=0.44

Checking that the sum of the cosines square is equal to 1.

cos^2⁡α+cos^2⁡β+cos^2⁡γ=〖0.22〗^2+〖0.87〗^2+〖0.44〗^2=1

3D lines - Example 4

Print Example 4
Question:
Given the 3D line

Find the equation of the line that passes through the point P (5, −1, 4) and is perpendicular to the given line.

Solution:
A general point on the parametric equation of the line will be:

x = 1 + 2t         y = 3t         z = −2 + 4t

The vector QP streched from the line to the point P is:

QP = (1 + 2t − 5)i + (3t − (−1))j +(−2 + 4t − 4)

QP = (−4 + 2t)i + (1 + 3t)j + (−6 + 4t)k

The line vector is: vL = 2i + 3j + 4k

To find the intersection point of the line with the perpendicular line we use the fact that the dot product of the vectors is equal to 0,     QP ∙ vL = 0

[(−4 + 2t)i + (1 + 3t)j + (−6 + 4t)k] ∙ (2i + 3j + 4k) = 0

−8 + 4t + 3 + 9t −24 + 16t = 0

4t + 9t + 16t = 24 − 3 + 8

29t = 29

t = 1

And the intersection point from the parametric line equations is:   x1: (3, 3, 2)

From the intersection and the given points x0: (5 , −1 , 4), we can derive the equation of the perpendicular line:

x = x0 + (x1 − x0)t = 5 + (3 − 5)t = 5 −2t

y = y0 + (y1 − y0)t = −1 + (3 + 1)t = −1 + 4t

z = z0 + (z1 − z0)t = 4 + (2 − 4)t = 4 − 2t

The direction numbers of the perpendicular line are (−2 , 4 , −2)

From the condition for two lines to be perpendicular we have:

−2 * 2 + 4 * 3 + −2 * 4 = 0