Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

3D Line intersection coordinates

Status
Not open for further replies.

nitin36537

Civil/Environmental
Feb 16, 2001
60
How to determined that two lines in 3D are intersecting or not? and if intersecting then at which point ? How to find coordinates of intersection point?

Coordinates of two lines are furnished in cells like
a1 contain x1 of line1
b1 contain y1 of line1
c1 contain z1 of line1

a2 contain x2 of line1
b2 contain y2 of line1
c2 contain z2 of line1


like for other line 2 ...

Thanks

Nitin

 
Replies continue below

Recommended for you

Rotate the coordinates so that any 3 points are in the XY plane.

If the the Z coordinate of the fourth point is zero, then the lines intersect.

If so, you now have 2D coordinates for the two lines, so you can fins the intersection point in the usual way.



Doug Jenkins
Interactive Design Services
 
The PLOT3 command in Matlab (Or Octave) will allow you to visualize the lines.
You can use the FZERO command to find intersections within a given range (f3 = f1 - f2, find f3 = 0 for the intersection). This may only work for functions of two variables, though. If that's the case you can look at intersections in the x-y, x-z, and y-z planes separately. If you get an intersection in all three planes, then the curves intersect.
 
Thanks everybody for helping.

iv63 & yakpol thanks for sharing excel sheet, I think excel formula in excel sheet attached is tobe used for line and not for line segment, How to determined that intersection point is on line segment only ?

Thanks

Nitin
 
When the solutions are all within their corresponding ranges of the segment.

Let your acquaintances be many, but your advisors one in a thousand’ ... Book of Ecclesiasticus
 
Write the three lines as a slope intersect set of equations. Check to see that they are solvable, and if so, then the solution is the point of intersection

Dikl
 
That would tell you if there is an intersection, but what he really wants to know is if there is an intersection of line segments, so you must still check to ensure that the solutions for x, y, z are within the ranges of the segments.

Let your acquaintances be many, but your advisors one in a thousand’ ... Book of Ecclesiasticus
 
Intersection will be within length of the segments when two conditions satisfied:
min(x1,x2) <= xo <= max(x1,x2) and
min(x3,x4) <= xo <= max(x3,x4)

 
The iv63 spreadsheet gives the wrong answer, and the yakpol spreadheet (which is otherwise very nice) does not give an answer with the iv63 data, because the lines are parallel when projected onto the XY plane.

My original suggestion works Ok, but is unnecessarily complicated.

In the attached spreadsheet the intersection of the two lines is found in the XY, XZ, and YZ planes. If an intersection exists in any two planes it checks that the coordinates in common are equal, and if so it returns these as the coordinates of the 3D intersection point. It then checks that this point is within the length of the line segment.



Doug Jenkins
Interactive Design Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor