Re: [Algorithms] 3d Lines Intersection
Brought to you by:
vexxed72
From: Eric H. <er...@ac...> - 2000-08-04 22:40:54
|
Albert_J 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) > > I've searched the web, but all of them seems to explain about 2D lines intersection only. An answer (but not online, unfortunately): Goldman, Intersection of Two Lines in Three-Space, Graphics Gems, p. 304. I looked it up on my 3D objects intersection page: http://www.realtimerendering.com/int/. I really need to find time to put down actual algorithms and code on this page (anyone want to give me a grant? ;^> ). Anyway, for two lines P1 _ V1*t and P2 + V2*s, where V1 and V2 are the direction vectors and P1 & P2 some points on the lines, the answer is: s = Determinant{(P2-P1),V1,V1 X V2} / | V1 X V2 |^2 If the lines are parallel, the denominator is 0. If the lines are skew (don't intersect), s and t represent the parameters of the points of closest approach - measure the distance between these two points and you'll know how far apart they are. Eric |