Line 3D geometry - defined by 2 points
Line defined by 2 points Point P1(x1,y1,z1) ( , , )
Point P2(x2,y2,z2) ( , , )
Distance from
P1 to P2
Line spherical angles
equation of the line
     x = + t
     y = + t
     z = + t
If   t = The equivalent point on the line is:
If   t = The equivalent point on the line is:
Line equation x +
= y +
= z +
Direction angles
Direction cosines
3D lines
Distance between two points
Line passing through two points
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:
The two points of the parametric equation of a line are:
The parametric equations of a line L through the point
with direction numbers a, b and c are given by the equations:
Two points formed by the equation of a line also may be written symmetrically as:
Two lines with slopes of (a1, b1, c1) and (a2, b2, c2) are perpendicular
to each other if and only if:
Two lines are parallel if:
Finding the distance d between 2 lines L1 and L2 that are given by the parametric equations:
Step (1) Calculate the cross product of the direction numbers, the result is a vector perpendicular to both lines:
Step (2) Find the norm of the vector (is a scalar value):
Step (3) The unit vector in this direction is:
Step (4) Find a point P on L1 where t = 0:
Step (5) Find a point Q on L2 where s = 0:
Step (6) Find vector PQ connecting P to Q by subtructing (Q ⎯ P):
PQ = [(x1 - x0), (y1 - y0), (z1 - z0)]
Step (7) The absolute value of the dot product of n with PQ will give the required distance d between the lines:
Example 1: Find a) the parametric equations of the line passing through the points P1(3, 1, 1) and P2(3, 0, 2). b) Find a point on the line that is located at a distance of 2 units from the point (3, 1, 1). 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 eqiuations yields the required point which can be located on either side of the line:
Example 2: 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).
The direction numbers (values of t) of the given A B line are:
The required line that passes through point (1, 1, ⎯ 2) is:
Example 3: Find the distance between the lines:
Step (1) Cross product of the direction numbers is:
Step (2) The norm of the vector is:
Step (3) The unit vector in the line direction:
Step (4) A point P on L1 where t = 0 is at: (3, ⎯ 2, 5)
Step (5) A point Q on L2 where s = 0 is at: (3, 2, ⎯ 1)
Step (6) (Q ⎯ P) = (0, 4 ⎯ 6)
Step (7) Finally the distance between the lines is:
Direction angles, direction cosines and direction numbers
A line has two sets of direction angles according to the pointing direction of the line
If α, β, γ are the direction angles of a line then the direction cosines
If d is the length of the line then the direction cosines values are:
The direction numbers are the length of the line projected on the 3 axes x, y and z and their values are a, b and c.