Artificial intelligent assistant

Find a right triangle section of a larger one I'm programming a game, and find myself stumped. I know the target ball (dx, dy) and (cue x, cue y) and the x value of the camera. It's been 20 years and I'm sad to say I've lost some ground here. So, I need the coordinates at the `^` character, where the diagonal intersects the camera bounds. Thank you. // // . dx, dy (ball) // off camera /| // __________ /_|____ camera x // /^ | need these coordinates (limit_x, limit_y) // camera / | | // /__| | // cue x,y^ | // _____________|

I think I see what you're trying to say.

Geometrically, you want to find the point where the line between $(x_{cue},y_{cue})$ and $(dx,dy)$ meets the line defined by $x=x_{cam}$ where $x_{cam}$ is the $x$-value of the camera. You already have the $x$-coordinate ($x_{cam}$) so you only need the $y$-coordinate, call it $y_{cam}$.

The slope of the diagonal line is $\left( \frac{dy-y_{cue}}{dx-x_{cue}}\right)$ and we can plug into the equation for a line to find that the $y$-intercept is $y_{cue} - \left( \frac{dy-y_{cue}}{dx-x_{cue}}\right)x_{cue}$. Hence, we find that

$$ y_{cam} = y_{cue} +\left( \frac{dy-y_{cue}}{dx-x_{cue}}\right) (x_{cam} - x_{cue}) $$ so that your point of intersection is $$ (x_{cam}, y_{cam}) = \left( x_{cam}, y_{cue} +\left( \frac{dy-y_{cue}}{dx-x_{cue}}\right) (x_{cam} - x_{cue}) \right)$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 137283e78c4e57640557e6f8bdb9c6f0