function [d,Fa,Fb] = skewlineIntersection(a,v,b,w)

%% Input:
% a: origin vector 1
% v: vector 1
% b: origin vector 2
% w: vector 2

%% Output:
% d: minimum Distance
% Fa: Nearest Point on vector1
% Fb: Nearest Point on vector2

%% Disnatce
% (https://de.wikipedia.org/wiki/Windschiefe)
n = cross(v,w);
n0 = n./norm(n);

d = abs(dot((a-b),n0));

%% nearest points:
n1 = cross(v,n);
n2 = cross(w,n);
Fa = (dot(a,n1)-dot(b,n1)) / dot(w,n1) * w + b;
Fb = (dot(b,n2)-dot(a,n2)) / dot(v,n2) * v + a;

end

