Answer the question
In order to leave comments, you need to log in
Intersection of two lines in 3D?
Given 2 lines as dots, x1,y1,z1 and x2,y2,z2
Answer the question
In order to leave comments, you need to log in
Firstly, these are not points, but vectors, or one line.
Secondly, this is not a question.
the equation of a straight line looks like this:
where a, b, c, r are constants
First of all, you find the coefficients for each line. This can be done by substituting the known points and solving the system of equations:
( {ax1+by1+cz1=r, ax2+by2+cz2=r}
here the quantities a,b,c,r are unknown) Repeat
the same for the second line z - point of intersection)
It is worth adding that the lines may not intersect or have an infinite number of intersections - this must be taken into account and checked.
You can simplify the solution using the vector representation and the corresponding libraries, but look for it yourself. Right here
chewed mat. description of the line in vector form. In English, but it's not scary, you can understand everything from the pictures.
First, determine that the lines lie on the same plane and are not parallel.
Let's denote the points of the first line as A1 and B1, and the second - A2 and B2.
Let's introduce the vectors D1 = B1-A1 and D2 = B2-A2. We introduce a vector equation.
D1*t + D2*r + (A1-A2) = 0.
There are 2 unknowns t and r, 3 equations (write in x, y and z).
If the system of equations is solved, then the point of intersection A1+D1*t or A2 - D2*r.
Here the truth will have to tinker with cases. We must try to solve the system only for x, y, then check in z. If it didn’t work out, then you still need to try to solve in x, z, then try to substitute the resulting r and t into y.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question