Hello Math Help Forum, I'm new here, and would first of all like to say hi

I am currently working on a 2D Lighting Engine software, and need to be able to determine a certain point (or at least the equation of the line passing through it). Here's an illustration:

What I would like to do is, knowing the values of r, x, y, x1, and y1, to find the values of x2 and y2 in terms of these variables (note that (x2, y2) is the tangent point of the line passing through the circle, (x, y) is the center of the circle, though not necessarily (0, 0), (x1, y1) is just a random point outside of the circle, and 'r' is the radius of the circle).

I had thought of using the right triangle to find the measurement of the upper side and equate that to the distance between (x1, y1) and (x2, y2), but ended up with a very complex equation that I probably wasn't able to simplify because of lack of further knowledge.

Hope I made myself clear, thank you!