Point-Line Projection

Result
If line L has the normalized direction vector l, and A is a point on L, the point P projected onto L is: PL = A + (AP dot l) * l

Derivation
P    | | A___|______ PL L

L is defined by the normalized direction vector l and A is a point on L.

By PL we denote the point P projected onto the line L.

. v /| / |d /__|_____ l  vl

We can also define the vector v = AP and the vector vl, which is the projection of v onto l.

vl = (v dot l) * l

where 'dot' signifies the dot product.

Now we can compute PL:

PL = A + vl = A + (AP dot l) * l