Carl
Carl

Reputation: 105

intercept and shortest distance bewteen 2 lines in 3D

I would like to find the intercept of 2 lines in 3D. How can I check if they really intercept withour calculating the the real 3D coorindate at first. And then how can I calculate the 3D coordinates of that particular point?

Secondly, I understand it is not possible to find intercept points if two lines do not intercept. Thus, I would like to find a way to calculate 3d point which has the minimium distance from both point. I come with two minimium distance requirements:
1. take the shortest distance connecting two points and take the mid point as my result
2. find the shortest perpendicular distance away from both lines

Would anyone can give me some tips on it?

Upvotes: 0

Views: 98

Answers (1)

user1196549
user1196549

Reputation:

Let the first line be P+u.U and the second Q+v.V, where uppercase letters are 3D vectors.

You want to minimize the (squared) distance, i.e.

D²(u, v) = ((P+u.U) - (Q+v.V))²

Then, deriving on u and v, you get the system of equations

D²'u(u, v) = 2U.D(u, v) = 0
D²'v(u, v) = 2V.D(u, v) = 0

or

U.P + U².u - U.Q - U.V.v = 0
V.P + U.V.u - V.Q - V².v = 0

Solve this linear system of 2 equations in the 2 unknowns u and v, and from these, the closest points.

In the special case that the lines are parallel, the system determinant U²V²-(U.V)² is zero, as one expects (actually it is the square of the cross product (UxV)²). You can set u=0 arbitrarily and solve for v.

Upvotes: 1

Related Questions