Re: [Algorithms] 3d Lines Intersection
Brought to you by:
vexxed72
From: <ro...@do...> - 2000-07-30 00:32:32
|
Jim Offerman wrote: >> Is there a good algo for finding a point of intersection between two *3D >lines*? >> The lines is specified by their point (x,y,z) and their direction >(dx,dy,dz) > >When I wrote my first renderer, I used a simple 3D intersection algorithm in >my (very alternative) projection system: > >- calculate (x, y) intersection (result <x1, y>) >- calculate (x, z) intersection (result <x2, z>) >- if (x1 == x2) the lines intersect at <x1, y, z> > >Of the top of my head I can't say whether this algorithm is 100% correct It is my sad duty to have to inform you (and I dearly hope that the news causes no undue emotional stress), that this putative algorithm is wrong. Here is the clearest, simplest to understand counterexample that I could construct (and there are clearly a bazillion others). Let line 1 be the x axis, so the line with parametric representation (s, 0, 0) Let line 2 be the line with parametric representation (0, t, t+1). Thus line 2 lies in the yz plane where it has the implicit equation z = y+1. The projection of line 1 on the xy plane is just the x axis. The projection of line 2 on the xy plane is the y axis, The intersection of these projections is (0,0,0). The projection of line1 on the xz plane is the x axis The projection of line 2 on the xz plane is the z axis The intersection of these projections is (0,0,0) So in your notation x1 = 0 = x2, and by your algorithm you claim that the lines intersect at (0,0,0). In fact they do not. Line 2 does not even pass through the point (0,0,0), In fact these two lines do not intersect at all, ever, nowhere, no way. In fact, it is a problem in freshman analytic geometry to show that the distance of closest approach of these two lines is sqrt(1/2), but I could as easily have made it a billion units. > (I >am not a math guy...), Which is no license to post wrong stuff.. > but, if properly implemented, it will certainly be >fast and provide at least a reasonable estimation. > Bah. I'm growing weary of playing math cop. Soon gonna turn in my badge. |