I have two points, $(x_0, y_0)$ and $(x_1, y_1)$. The point $(x_0, y_0)$ is on a line, which has angle $\theta$, relative to the X-axis.
Using these values, I want to be able to calculate the shortest distance, $d$, along the line (relative to $(x_0, y_0)$) which is less than 2 units away from $(x_1, y_1)$.
I suspect there may be something to do with slope and arctangent, but I can't make heads or tails of how I should attempt this (It's for a video game, in case that matters).
Sorry if this is a dupe, or if my math-speak is a bit too much programmer and a bit too little mathematician.