Center of circle that has two points on its circumference and a known tangent

I've found a related question, which helped me get started on this. I can get it to work for the example on the question, but I'm running into an issue when the tangent is not y = 0.

Other question is here: How to Determine an Equation of a Circle using a Line and Two Points on a Circle

Sorry I can't post a picture as I don't have enough reputation.. One can be found at http://www.chucara.dk/images/Voronoi3.png

My question is: Given two points P1:$(10,10)$ and P2:$(20,20)$ and a tangent of $y = 40$, what is the center of the circle O:$(a,b)$ that has both points on its circumference and has the line as a tangent.

I've tried reducing my problem by simply subtracting the tangent from the points' $y$ coordinate and using the example in the other post with points $(10,-30)$ and $(20, -20)$.

This gives me a normal of $y = -x-10$

I using the pythagoran theorem and the equation of the normal, I get to the quadratic equation:

$0 = x^2 - 80x + 400$

I solve this, and get two solutions (rounded): $x = 5.36$ and $x = 74.64$

In turn, giving me: $(5.36, 24.64)$ and $(74.64, -44.64)$

However, this doesn't seem right. Can anyone tell me where I've gone wrong in my calculations? Or how would you solve it?

Just to give a bit of background, I'm trying to implement this in C#, so I need a general solution. This is what is causing my headaches.

• Thanks for the edit Micah. I'm new to the forum. May 5 '13 at 21:59
• If you think of a tangent at $y=0$ and say points on the circumference at $(-10, 10)$ and $(10, 10)$ you'll see that all you can say is that the center is on the half line $(0, y)$ with $y \ge 10$. Your problem is underdetermined. May 5 '13 at 23:33
• @vonbrand: That's not true. There are two solutions, but the conditions do constrain the centre more than just to a half line. May 6 '13 at 5:29