Equation of lines tangent to circle

Tangent Lines to Circle
(click to enlarge)
Happen to work up my own solution to this the other day, so I'm posting it here. This was intended to plug into a spreadsheet. It's probably less elegant than possible and less complete than needed, but, oh well.

It's assumed that all points are co-planar, so nothing fancy going on here. Refer to the illustration above. Clicking it should return a larger (readable) version.

Given:
• a circle, (x - h)² + (y - k)² = r²,
with center at (h, k) and radius r; and
• a point at (p, q) outside the circle:
Find:
• the coordinates of the tangent point(s), and
• the equation(s) of the tangent line(s) from the point to the circle.

Through any given outside point, there are two possible tangent lines to a given circle, but once you find one, finding its doppelgängers is just a matter of changing a few signs.
Let Δ = ±1 to express that sign change.

Let ∆ABC be such that:
• A is the vertex at (h, k), which is the center of the given circle,
• B is the vertex at given point at (p, q), and
• C is the tangent point.

Notice that ∆ABC is a right triangle by definition because any tangent line is perpendicular to the radius at the point of intersection.
So:
c = AB (the hypotenuse as shown) = √([p - h)² + (q - k)²]
α = ∠CAB = acos[r / c]
β = ∠ABC = asin[r / c] — reference only, not used in these calculations
γ = ∠BCA = π/2 — reference only, not used in these calculations
δ = acos[(p - h) / c]
(if you are wondering, α is "alpha," β is "beta,"  γ is "gamma," δ is small "delta," and Δ is capital "delta.")
δ is just used for the angle between the x-axis and c.
(See: Convert cartesian ↔ polar coordinates for some more details if you like.)

Tangent Point CΔ:

Δ = ±1
x = r · cos[α + Δδ] + h, and
y = Δr · sin[α + Δδ] + k

Tangent Line, y = mΔx + bΔ:
Δ = ±1
mΔ = –Δ/tan[α + Δδ], and
bΔ = Δ(r · cos[α + Δδ] + h) / tan[α + Δδ] + Δr · sin[α + Δδ] + k

Sample Calculation
Given:
Circle: (x - 0.6)² + (y - 0.5)² = 1.5625
Point: (-0.625, 2.25)
h = 0.6; k = 0.5; r = 1.25
p = -0.625; q = 2.25
δ ≈ 2.18152
α ≈ 0.94571

Δ=1:Tangent Point: (-0.6499, 0.5179); Tangent Line: y = 69.641x +45.7756

Δ=-1:
Tangent Point: (1.0109, 1.6805); Tangent Line: y = -0.3481x +2.0324

No comments: