Math, asked by ABHISHEKshing6652, 1 year ago

Shortest distance between 2 parallel lines in 3d

Answers

Answered by Anonymous
0
Assuming that you mean two parallel (and infinite) line equations:
 
Each line will consist of a point vector and a direction vector.
 
Imagine a plane extending from the starting point of the first line with its normal direction pointing along the line (i.e. away from the plane).
 
The second line will intersect the plane at the point at which it is closest to the first line.
 
If line 1 consists of the point p1 and direction d1 and line 2 consists of the point p2 and direction d2 then the vector 't' representing the translation of one of the vectors to the other can be found like this:
 
t = p2 - p1  - ( d1 * ( dot( ( p2 - p1 ), d1 ) / dot( d1, d1 ) ) )
 
This projects the starting point of the second line backwards along the direction of the first line to the plane passing through the starting point of the first line. It then subtracts the starting point of the first line.
 
Note that we don't even need to use the direction of the second line.
 
The shortest distance can be found by taking the length of t:
 
shortest distance = root( dot( t, t ) )
Similar questions