from a quick glance at the code you linked to, it appears they express the two vectors as follows:
a start point, and a unit vector in the desired direction, times a constant magnitude.
they then assume the two vectors intersect, and solve for the two constants when the resulting endpoints are the same:
unit_vector_1 * constant_1 = unit_vector_2 * constant_2
i'd find a book on vector math, use a different better documented algo, black box test thoroughly, or find a math nut who memorizes this kind of stuff.