Given a line and a point, how do you calculate the point on the line that is exactly 45 degrees? Given a line connected by two points, (x1, y1) & (x2, y2).
And given a point not on the line, (x3, y3).
How do you calculate the point on the line that creates a line at a 45 degree angle. We'll call this point (x4, y4).

Thank you!
EDIT: *Question from the comments
If the (x3, y3) point is "far" from the line-segment created by (x1,y1), (x2,y2). It wouldn't be possible to create a 45 degree angle like describe in this picture. How can I check for this?

One way to do it, could be a more elegant way:
First, we find the equation of a line through points $(x_{1},y_{1})$ and $(x_{2},y_{2})$. After that, we find the line through the point $(x_{3},y_{3})$ which is perpendicular to the line through points $(x_{1},y_{1})$ and $(x_{2},y_{2})$. After we do that, we find the intersecting point of those two lines, lets call it point $(x_{5},y_{5})$. Now we have one leg of the right triangle. We find the length of that leg, and we know that the angle being 45 degrees, both legs are the same length. Now we just add that length of the leg to the point $(x_{5},y_{5})$, and solve for point $(x_{4},y_{4})$. You will get two points by doing this. 
Hope this helps, cheers!
