Shortest distance between two skew lines in 3D space.
HTML-код
- Опубликовано: 8 апр 2013
- An example of finding the shortest distance between two lines in 3D space which do not intersect.
The lines are specified only by a point on them and their direction vectors, and from this general points on each line are established in terms of parameters.
The resulting vector from one point to the other then leads to the parameters of the points required and the distance between them.
The same general vector would give the point of intersection if its components could form the zero vector.
The accent is what kept me going.
Watched the first time for the accent, and the second for the math. Great video :)
That explanation was simply wonderful. You have a real gift of teaching!
Gosh no.
This comes from Glasgow in Scotland.
Och aye the noo!
this guy should teach everything ever with that accent of his!!!
You're an amazing instructor, this was one of the clearest instructional videos I've ever seen. I'm also trying to figure out how to find the shortest distance between to skew line *segments*, could you make a video for that as well?
Awesome accent. Thx for the video.
I wish you wrote the fp3 vectors chapter in my edexcel textbook. Thank you so much keep up the good work!
omg this was so helpful! thank-you from Australia! (yr 12 :))
Great example! Your explanation really cleared things up!
that was fantastic - and with a great accent as well...very clean, well done !!
So good! You sir, are fantastic. I may pass this test...
Thank you! You helped me a lot!
Great video teaching :) absolutely loved it and the disappearing whiteboard!
You sir, are amazing!
You are an absolute god, thank you very much!!!
Very clear. Thanks.
Great job! really helpful
Good explanation!! thanks man!
really really really gr8 video.
I was searching for good explanation and couldn't find until I found this.
now I know how to solve what I want to do with programming.
I watched it several times to learn how to do formula.
Really thanks :)
heh that's gr8 :) non thumbs down on this video I've never saw this before.
also here's code if someone will be in need to:
public static void ClosestPointsOnTwoLines(Vector3 Origin1, Vector3 Direction1, Vector3 Origin2, Vector3 Direction2, out Vector3 closestPointLine1, out Vector3 closestPointLine2){
closestPointLine1 = Vector3.zero;
closestPointLine2 = Vector3.zero;
float a = Vector3.Dot(Direction1, Direction1);
float b = Vector3.Dot(Direction1, Direction2);
float e = Vector3.Dot(Direction2, Direction2);
float d = a*e - b*b;
// if lines are not parallel
if(d != 0){
Vector3 r = Origin1 - Origin2;
float c = Vector3.Dot(Direction1, r);
float f = Vector3.Dot(Direction2, r);
float s = (b*f - c*e) / d;
float t = (a*f - c*b) / d;
closestPointLine1 = Origin1 + Direction1 * s;
closestPointLine2 = Origin2 + Direction2 * t;
}
}
this is code using Unity 3D engine C# language witch is similar to C#/C/C++
can we also solve this problem by finding the cross product of both lines then using the method of projection to find the shortest distance?
thank you, really helpful!
This would only work for infinite lines right? What if your lines are limited in 3d space point to point?
I love the diagram. it all makes sense now.
Wowwwww, thank you so much!
Absolutely brilliant. Just checking, there are other ways to do this right? I was taught a more difficult way which was taking a scalar projection of a vector between the two points on a line onto the normal vector of the two lines (using cross product)
I was just curious if this is the same thing!
it´s the same thing. he is checking where the cross product is zero.
Jorgen Bengtsson Cross product is a vector so it can't equal a scalar. You mean where dot product is 0
There are so many different ways you can do this I just don't know which I prefer.
wow i had to figure this out by myself because my teacher didnt tell us how to do it, but at least i was able to confirm that i was correct, nice video
If the lines did happen to intersect, does that mean the shortest distance is , for example 0 ( as in your video, if the equations were consistent?)
DLBmaths witch one is easier your method? or mine? I'm asking for your honest opinion.
Why is it at the shortest distance they are perpendicular to PQ
The shortest distance to a line is the path perpendicular to the line from any point.
The corresponding points on each line at the shortest distance must therefore both be on a line perpendicular to the other.
You are a mathematical William Wallace. cheers mate
can we just let poinT P as (0,2,-1) and Q as (1 , 0 -1) ??
Just to be clear on the picture you drew the two lines intersecting but I am assuming one goes behind the other right ? cause if they intersect then the shortest distance would be zero at that point. Please clarify
I like your accent ! British ehh ?
lolawesome
Thank you very much. Lol
beutiful
i've got to ask, are you a canadian