Advertisement

Closet points between two line.

Started by November 29, 2002 03:11 PM
8 comments, last by Bobby-D 22 years, 2 months ago
Does anybody out there know how to find the two closest points between two lines in 3D space? If you do please tell me how! One by one, the peguins steal my sanity.
One by one, the peguins steal my sanity.
This question was posted about a week or so ago. Check the archives
Advertisement
Check out the Siggraph (2002) paper by Bridson, Fedkiw, and Anderson called "Robust Handling of Collision, Contact and Friction for Cloth Animation". It shows how find the two closest points on the lines.

- Mikko Kauppila
well, if you had a line connecting these two other lines at their closest points, it would be perpendicular to both lines...

You could do some math (linear algebra maybe) to find a plane for which one of the lines is a normal vector, and the other is "in" the plane, and the place where the plane intersects the "normal" line is the point on that line, and then you''d find the distance on the plane between the two lines

that might be a little complicated though
quote:
Original post by uutee
Check out the Siggraph (2002) paper by Bridson, Fedkiw, and Anderson called "Robust Handling of Collision, Contact and Friction for Cloth Animation". It shows how find the two closest points on the lines.

- Mikko Kauppila

Thanx, but I don''t suppose you have the URL?

One by one, the peguins steal my sanity.
One by one, the peguins steal my sanity.
Search for it here
Advertisement
I've not read other message but, I did it.

compute the crossproduct(PerpendicularDir) of both lines, this is the perpendicular line to the 2 lines.
Then make a plane for each line from these 3 points: LinePt1 , LinePt2 and LinePt1 + PerpendicularDir;
Then compute intersection point of the line and the plane. this is the ClosestPoint for this line. Same thing for second line.

Fantasio.



[edited by - fantasio on December 2, 2002 3:24:58 PM]
quote:
Original post by Fantasio
I''ve not read other message but, I did it.

compute the crossproduct(PerpendicularDir) of both lines, this is the perpendicular line to the 2 lines.
Then make a plane for each line from these 3 points: LinePt1 , LinePt2 and LinePt1 + PerpendicularDir;
Then compute intersection point of the line and the plane. this is the ClosestPoint for this line. Same thing for second line.

Fantasio.



[edited by - fantasio on December 2, 2002 3:24:58 PM]



Thanx a LOAD. That sounds pretty easy when you put it like that. I''ll give it a go!



One by one, the peguins steal my sanity.
One by one, the peguins steal my sanity.
quote:
Original post by Fantasio
I''ve not read other message but, I did it.

compute the crossproduct(PerpendicularDir) of both lines, this is the perpendicular line to the 2 lines.
Then make a plane for each line from these 3 points: LinePt1 , LinePt2 and LinePt1 + PerpendicularDir;
Then compute intersection point of the line and the plane. this is the ClosestPoint for this line. Same thing for second line.

Fantasio.



Somebody tell me if I''m off my rocker. I haven''t tried it, but:

Define line #1 as a point p1 and a unit vector v1.
Ditto for line #2
p1 + v1*dot(v1, p2-p1) // closest point on line #1
p2 + v2*dot(v2, p1-p2) // closest point on line #2

And I think I''m remembering my vector math right.
Aaargh! Everyone save your workspaces before your program locks up your computer!
if the lines intersect, it is the intersection point, and else, it is one of the end points and a point on the other line.

This topic is closed to new replies.

Advertisement