Find the coordinates of the closest point between two lines in 3d space.

70 Views Asked by At

I have not worked with 3d coordinate systems for a while and this is giving me a bit of a struggle. I have the coordinates of four points in XYZ. Two points I use to generate the line AB and the other two I use to generate line CD. I would like to find the closest XYZ coordinate on AB to line CD and the closest XYZ coordinate on CD to line AB. My idea was to find the equation for the perpendicular line between AB and CD and then find the intersection of this new line with AB and CD. However, I do not really know where to begin. If anyone could help that would be very much appreciated