Watch this Author's files
Quick and effective. However, I believe there is a typo in the documentation:
'intNormalizedDistance2To1' : N1xN2 matrix where the (i,j) entry is the normalized distance from the start point of line segment XY1(j,:) to the intersection point with XY2(i,:).
This description is the same as intNormalizedDistance1To2 except that i and j are swapped in the description, and that doesn't really make any sense. I believe XY1 and XY2 should also be swapped.