Let's say a vector starts at Point P and points in the direction of v. How do I make sure that this vector exactly reaches the line? Its end should be exactly on the line, and not cross it.

|
|
|
You should calculate the intersection point (IP) between the two lines.
Solve the two equations and you get IP (X,Y). Maybe you'd need to check that IP is between A and B... before continue... Then you build a new line with this equation:
EDIT:
Remember:
|
|||||||||||||
|
You should:
Example:
|
|||||||||||
|