The distance d from a point P (xp,yp,zp) to the line that passes through the two points A (xA,yA,zA) and B (xB,yB,zB) can be calculated by d=2S/r where r is the distance between the points A and B, given by
r
=
(
x
B
−
x
A
)
2
+
(
y
B
−
y
A
)
2
+
(
z
B
−
z
A
)
2
and S is the area of the triangle defined by the three points calculated by where
s
=
s
1
2
+
s
2
2
+
s
3
3
where
s
1
=
x
P
y
A
+
x
A
y
B
+
x
B
y
P
−
(
y
P
x
A
+
y
A
x
B
+
y
B
x
P
)
s
2
=
y
P
z
A
+
y
A
z
B
+
y
B
z
P
−
(
z
P
y
A
+
z
A
y
B
+
z
B
y
P
)
s
3
=
x
P
z
A
+
x
A
z
B
+
x
B
z
P
−
(
z
P
x
A
+
z
A
x
B
+
z
B
x
P
)
. Determine the distance of point P(2,6,-1) from the line that passes through point A(-2, -1.5,-3) and point B(-2.5,6,4). First define the variables xP,yP,zP, xA, yA, zA, xB,yB, and zB,and then use the variable tocalculate s1, s2, s3. and r. Finally calculate S and d.